Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
1. Change Str(number) to CStr(number)
2. Add compare Shape.Connecter
3. Change README
  • Loading branch information
ta-kon committed May 7, 2018
1 parent 9ebccae commit 094f6f1
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 10 deletions.
Binary file modified Numbering-ExcelAddin.xlam
Binary file not shown.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ Excelに「連番太郎」というリボンが作成されます。

## 6. Install

1. 以下の場所からダウンロード
1. 以下の場所から「Source code (zip)」をダウンロード
https://github.com/ta-kon/Numbering-ExcelAddin/releases

2. ダウンロードしたzipファイル内にある
2. ダウンロードしたzipファイルを展開し、
展開したフォルダ内にある
Install.vbs を実行

Excelのリボンに「連番太郎」が追加されます。
Expand All @@ -101,7 +102,10 @@ Uninstall.vbs を実行
VBAコーディングの目安にさせて頂きました。

[Try #008 – VBAのモダンな開発環境を構築してみた | dayjournal memo](https://day-journal.com/memo/try-008/)
VBAをVS Codeでコーディングする際に利用しました。これが無かったら、開発に挫折していました。
VBAをVS Codeでコーディングする際に参考にしました。

[tcsh/text-scripting-vba: Modules for text scripting on VBA](https://github.com/tcsh/text-scripting-vba)
VBAをVS Codeでコーディングする際に使用したマクロ。これが無かったら、開発に挫折していました。

[IRibbonUIオブジェクトがNothingになったときの対処法](http://www.ka-net.org/ribbon/ri64.html)
リボンUIを利用する際に、オブジェクトがNothingになったので参考にしました。
Expand Down
73 changes: 69 additions & 4 deletions source/Controller.bas
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,84 @@ End Function

Private Function equalsShape(ByVal leftShape As Shape, ByVal rightShape As Shape) As Boolean

' 独立性が高い順から比較するため、色の情報から比較
' 独立性が高い順から比較し、比較回数を減らすため、色の情報から比較
' VBAでは短絡評価をしないので、一つひとつ評価
If (IS_SELECT_COLOR) Then
' 塗りつぶしの色
If (leftShape.Fill.ForeColor.RGB <> rightShape.Fill.ForeColor.RGB) Then
equalsShape = FALSE
Exit Function
End If

' 塗りつぶしの表示
If (leftShape.Fill.Visible <> rightShape.Fill.Visible) Then
equalsShape = FALSE
Exit Function
End If

' 塗りつぶしの透明度
If (leftShape.Fill.Transparency <> rightShape.Fill.Transparency) Then
equalsShape = FALSE
Exit Function
End If

' 線色
If (leftShape.Line.ForeColor.RGB <> rightShape.Line.ForeColor.RGB) Then
equalsShape = FALSE
Exit Function
End If

' 線の表示
If (leftShape.Line.Visible <> rightShape.Line.Visible) Then
equalsShape = FALSE
Exit Function
End If

' 線の透明度
If (leftShape.Line.Transparency <> rightShape.Line.Transparency) Then
equalsShape = FALSE
Exit Function
End If
End If

If (IS_SELECT_FIGURE) Then
' 図形
If (leftShape.AutoShapeType <> rightShape.AutoShapeType) Then
equalsShape = FALSE
Exit Function
End If

' コネクタ
If (leftShape.Connector <> rightShape.Connector) Then
equalsShape = FALSE
Exit Function
End If

If (leftShape.Connector And rightShape.Connector) Then
' コネクタの種類
If (leftShape.ConnectorFormat.Type <> rightShape.ConnectorFormat.Type) Then
equalsShape = FALSE
Exit Function
End If
End If

' 点線のスタイル
If (leftShape.Line.DashStyle <> rightShape.Line.DashStyle) Then
equalsShape = FALSE
Exit Function
End If

' 線種 (1本線, 2本線)
If (leftShape.Line.Style <> rightShape.Line.Style) Then
equalsShape = FALSE
Exit Function
End If

' 太さ
If (leftShape.Line.Weight <> rightShape.Line.Weight) Then
equalsShape = FALSE
Exit Function
End If
End If

If (IS_SELECT_SIZE) Then
Expand Down Expand Up @@ -291,7 +355,7 @@ Private Function setShapeNumbering(ByRef shapeArray() As Shape, Optional startNu
Set shape = shapeArray(index)

If (IS_CHANGE_TEXT) Then
Call changeColor(shape, Str(number))
Call changeColor(shape, CStr(number))
End If

Call setShapeText(shape, number)
Expand All @@ -307,7 +371,8 @@ End Function

Private Sub changeColor(ByVal shape As Shape, ByVal compareText As String)
Dim shapeText As String
shapeText = getShapeText(shape)
shapeText = Trim(getShapeText(shape))
compareText = Trim(compareText)

if (shapeText <> "" And shapeText <> compareText) Then
Call setShapeTextColor(shape)
Expand Down Expand Up @@ -403,4 +468,4 @@ Private Sub sort(ByRef shapeArray() As Shape)
End If

Next index
End Sub
End Sub
6 changes: 3 additions & 3 deletions source/libdef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
' 各種操作の設定
' ______________________________________

./source/Model.bas
./Model.bas

' ______________________________________
' # View
Expand All @@ -13,7 +13,7 @@
' 処理の開始・終了のメッセージ出力
' ______________________________________

./source/Controller.bas
./Controller.bas

' ______________________________________
' # Controller
Expand All @@ -25,4 +25,4 @@
' ソート
' ______________________________________

./source/View.bas
./View.bas

0 comments on commit 094f6f1

Please sign in to comment.