Skip to content

Commit

Permalink
add new tools
Browse files Browse the repository at this point in the history
new tools upper and lower case
  • Loading branch information
vbatools committed Apr 15, 2021
1 parent e992516 commit 1528be3
Show file tree
Hide file tree
Showing 35 changed files with 398 additions and 335 deletions.
Binary file modified Addin_MacroTools_ENG.xlsb
Binary file not shown.
Binary file modified Addin_MacroTools_RUS.xlsb
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/Class_Modules/VBECommandHandler.cls
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Private Sub EvtHandler_Click(ByVal Ctrl As CommandBarButton, CancelDefault As Bo
16: Exit Sub
ErrorHandler:
18: If Err.Number <> 0 Then
19: Debug.Print "Error in Eventhandler_Click" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
19: Debug.Print "Error in Eventhandler_Click" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
20: Call WriteErrorLog("EvtHandler_Click")
21: Err.Clear
22: Resume Next
Expand Down
6 changes: 2 additions & 4 deletions scripts/Modules/A_RibbonCallbacks.bas
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ Option Explicit
Private Sub RefrasBtn(ByRef control As IRibbonControl)
28: If VBAIsTrusted Then
29: Call B_CreateMenus.RefreshMenu
30: Else
31: Call MsgBox(C_Const.sMSGVBA1, vbCritical, C_Const.sMSGVBA2)
32: End If
33: End Sub
Private Sub ImportCodeBaseBtn(ByRef control As IRibbonControl)
Expand All @@ -46,7 +44,7 @@ ErrorHandler:
Case 91:
46: Call MsgBox("No open files" & Chr(34) & "Excel files" & Chr(34) & "!", vbOKOnly + vbExclamation, "Error:")
47: Case Else:
48: Call MsgBox("Error in ImportCodeBaseBtn" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl, vbOKOnly + vbExclamation, "Error:")
48: Call MsgBox("Error in ImportCodeBaseBtn" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl, vbOKOnly + vbExclamation, "Error:")
49: Call WriteErrorLog("ImportCodeBaseBtn")
50: End Select
51: Err.Clear
Expand Down Expand Up @@ -117,7 +115,7 @@ ErrorHandler:
Case 91:
117: Call MsgBox("No open files" & Chr(34) & "Excel files" & Chr(34) & "!", vbOKOnly + vbExclamation, "Error:")
118: Case Else:
119: Call MsgBox("Error in onUnProtectSheets" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl, vbOKOnly + vbExclamation, "Error:")
119: Call MsgBox("Error in onUnProtectSheets" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl, vbOKOnly + vbExclamation, "Error:")
120: Call WriteErrorLog("onUnUnProtectSheets")
121: End Select
122: Err.Clear
Expand Down
23 changes: 17 additions & 6 deletions scripts/Modules/B_CreateMenus.bas
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@ Public Sub AddContextMenus()
Call AddButtom(C_Const.RTAG1, 162, "ReName Control", "RenameControl", C_Const.RENAMEMENU, True)
Call AddButtom(C_Const.RTAG2, 22, "Paste Style", "PasteStyleControl", C_Const.RENAMEMENU, True)
Call AddButtom(C_Const.RTAG3, 1076, "Copy Style", "CopyStyleControl", C_Const.RENAMEMENU, True)
Call AddButtom(C_Const.RTAG4, 704, "Paste Icon", "AddIcon", C_Const.RENAMEMENU, True, True)
Call AddButtom(C_Const.RTAG5, 0, "UPPER Case", "UperTextInControl", C_Const.RENAMEMENU, True, False)
Call AddButtom(C_Const.RTAG6, 0, "lower Case", "LowerTextInControl", C_Const.RENAMEMENU, True, False)

Call AddButtom(C_Const.CTAG1, 2045, "Copy Module", "CopyModyleVBE", C_Const.COPYMODULE, True, False)

Call AddButtom(C_Const.RTAG2, 22, "Paste Style", "PasteStyleControl", C_Const.mMSFORMS, True)
Call AddButtom(C_Const.RTAG3, 1076, "Copy Style", "CopyStyleControl", C_Const.mMSFORMS, True)
Call AddButtom(C_Const.RTAG5, 0, "UPPER Case", "UperTextInForm", C_Const.mMSFORMS, True, False)
Call AddButtom(C_Const.RTAG6, 0, "lower Case", "LowerTextInForm", C_Const.mMSFORMS, True, False)
End Sub
Private Sub AddNewCommandBarMenu(ByVal sNameCommandBar As String)
Dim myCommandBar As CommandBar
Expand Down Expand Up @@ -160,9 +164,13 @@ Public Sub DeleteContextMenus()
Call DeleteButton(C_Const.RTAG2, C_Const.RENAMEMENU)
Call DeleteButton(C_Const.RTAG3, C_Const.RENAMEMENU)
Call DeleteButton(C_Const.RTAG4, C_Const.RENAMEMENU)
Call DeleteButton(C_Const.RTAG5, C_Const.RENAMEMENU)
Call DeleteButton(C_Const.RTAG6, C_Const.RENAMEMENU)

Call DeleteButton(C_Const.RTAG2, C_Const.mMSFORMS)
Call DeleteButton(C_Const.RTAG3, C_Const.mMSFORMS)
Call DeleteButton(C_Const.RTAG5, C_Const.mMSFORMS)
Call DeleteButton(C_Const.RTAG6, C_Const.mMSFORMS)

Set myCommandBar = Application.VBE.CommandBars(C_Const.TOOLSMENU)
If Not myCommandBar Is Nothing Then
Expand All @@ -186,7 +194,7 @@ ErrorHandler:
Case 5:
Err.Clear
Case Else:
Debug.Print "Error in DeleteContextMenus" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
Debug.Print "Error in DeleteContextMenus" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
Call WriteErrorLog("DeleteContextMenus")
End Select
Err.Clear
Expand All @@ -204,24 +212,27 @@ Private Sub DeleteButton(ByRef sTag As String, ByVal sMenu As String)
Next Ctrl
Exit Sub
ErrorHandler:
Debug.Print "Error in DeleteButton" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
Debug.Print "Error in DeleteButton" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
Call WriteErrorLog("DeleteButton")
Err.Clear
Resume Next
End Sub
Public Function VBAIsTrusted() As Boolean
On Error GoTo ErrorHandler
Dim sTxt As String
sTxt = Application.VBE.Version
VBAIsTrusted = True
Exit Function
ErrorHandler:
Select Case Err.Number
Case 1004:
If ThisWorkbook.Name = C_Const.NAME_ADDIN & ".xlam" Then Call MsgBox("Warning!" & C_Const.NAME_ADDIN & vbLf & vbNewLine & _
'If ThisWorkbook.Name = C_Const.NAME_ADDIN & ".xlam" Then
Call MsgBox("Warning! " & C_Const.NAME_ADDIN & vbLf & vbNewLine & _
"Disabled: [Trust access to the VBA object model]" & vbLf & _
"To enable it, go to: File->Settings->Security Management Center->Macro Settings" & _
vbLf & vbNewLine & "And restart Excel", vbCritical, "Warning:")
Case Else:
Debug.Print "Error! in VBA, isTrusted" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
Debug.Print "Error! in VBA, isTrusted" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
Call WriteErrorLog("VBAIsTrusted")
End Select
Err.Clear
Expand Down Expand Up @@ -266,7 +277,7 @@ End Sub
Public Sub RefreshMenu()
Call B_CreateMenus.DeleteContextMenus
Call B_CreateMenus.AddContextMenus
Call MsgBox("The add" & C_Const.NAME_ADDIN & "-in was rebooted!", vbInformation, "The add" & C_Const.NAME_ADDIN & ":")
Call MsgBox("The add-in " & C_Const.NAME_ADDIN & " - was rebooted!", vbInformation, "The add" & C_Const.NAME_ADDIN & ":")
End Sub
Private Sub subMsgBoxGenerator()
MsgBoxGenerator.Show
Expand Down
2 changes: 2 additions & 0 deletions scripts/Modules/C_Const.bas
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ Public Const RTAG1 As String = NAME_ADDIN & "_VBE_RENAME_TAG1"
Public Const RTAG2 As String = NAME_ADDIN & "_VBE_RENAME_TAG2"
Public Const RTAG3 As String = NAME_ADDIN & "_VBE_RENAME_TAG3"
Public Const RTAG4 As String = NAME_ADDIN & "_VBE_RENAME_TAG4"
Public Const RTAG5 As String = NAME_ADDIN & "_VBE_RENAME_TAG5"
Public Const RTAG6 As String = NAME_ADDIN & "_VBE_RENAME_TAG6"

Public Const POPMENU As String = "Code Window"
Public Const TOOLSMENU As String = NAME_ADDIN & " ToolBar"
Expand Down
8 changes: 4 additions & 4 deletions scripts/Modules/C_PublicFunctions.bas
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,16 @@ ErrorHandler:
'* ByVal sTxt As String :
'*
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Public Function TrimSpace(ByVal stxt As String) As String
Public Function TrimSpace(ByVal sTxt As String) As String
297: Dim sTemp As String
298: Const LENGHT_CELLS As Long = 32767
299: sTemp = stxt
299: sTemp = sTxt
300: If VBA.Len(sTemp) <= LENGHT_CELLS Then
301: sTemp = Application.WorksheetFunction.Trim(sTemp)
302: Else
303: Dim i As Long
304: For i = 1 To VBA.Len(stxt) Step LENGHT_CELLS
305: sTemp = sTemp & Application.WorksheetFunction.Trim(VBA.Mid$(stxt, i, LENGHT_CELLS))
304: For i = 1 To VBA.Len(sTxt) Step LENGHT_CELLS
305: sTemp = sTemp & Application.WorksheetFunction.Trim(VBA.Mid$(sTxt, i, LENGHT_CELLS))
306: Next i
307: End If
308: TrimSpace = sTemp
Expand Down
2 changes: 1 addition & 1 deletion scripts/Modules/D_OnAction.bas
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ errmsg:
50: If Err.Number = 91 Then
51: Debug.Print "Snippet not found, selected:" & str_search
52: Else
53: Debug.Print "Error in Insert Code!" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
53: Debug.Print "Error in Insert Code!" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
54: Call WriteErrorLog("InsertCode")
55: End If
56: Err.Clear
Expand Down
8 changes: 4 additions & 4 deletions scripts/Modules/E_AddEnum.bas
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ errmsg:
52: Case 76:
53: Debug.Print "Module: [" & VBName & "] added to the book:" & ActiveWorkbook.Name & vbLf & "The file is not saved!"
54: Case Else:
55: Debug.Print "Error in Add Module To Project" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
55: Debug.Print "Error in Add Module To Project" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
56: Call WriteErrorLog("AddModuleToProject")
57: End Select
58: End Sub
Expand Down Expand Up @@ -171,7 +171,7 @@ ErrorHandler:
131: Case 76:
132: Debug.Print "Module: [" & VBName & "] has been removed, from the workbook:" & ActiveWorkbook.Name & vbLf & "The file is not saved!"
133: Case Else:
134: Debug.Print "Error in Delete Module To Project" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
134: Debug.Print "Error in Delete Module To Project" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
135: Call WriteErrorLog("DeleteModuleToProject")
136: End Select
137: Err.Clear
Expand All @@ -189,7 +189,7 @@ ErrorHandler:
Case 76:
150: AddFileName = ActiveWorkbook.Name
151: Case Else:
152: Debug.Print "Error in Add FileName" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
152: Debug.Print "Error in Add FileName" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
153: Call WriteErrorLog("AddFileName")
154: End Select
155: Err.Clear
Expand Down Expand Up @@ -249,7 +249,7 @@ ErrorHandler:
Case 76:
210: Call MsgBox("The file is not saved, save the file!", vbCritical, "Error:")
211: Case Else:
212: Debug.Print "Error in Copy Module Form" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
212: Debug.Print "Error in Copy Module Form" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
213: Call WriteErrorLog("CopyModuleForm")
214: End Select
215: Err.Clear
Expand Down
2 changes: 1 addition & 1 deletion scripts/Modules/F_AddInInstall.bas
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ InstallationAdd_Err:
47: MsgBox "To install the add-in, please close this file and run it again.", _
64, "Installation"
49: Else
50: MsgBox Err.Description & vbCrLf & "â F_AddInInstall.InstallationAdd " & vbCrLf & "in the line" & Erl, vbExclamation + vbOKOnly, "Error:"
50: MsgBox Err.Description & vbCrLf & "â F_AddInInstall.InstallationAdd " & vbCrLf & "in the line " & Erl, vbExclamation + vbOKOnly, "Error:"
51: Call WriteErrorLog("F_AddInInstall.InstallationAdd")
52: End If
53: End Sub
Expand Down
8 changes: 4 additions & 4 deletions scripts/Modules/G_AddCodeViewForm.bas
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Option Explicit
5: Set frm = New AddEditCode
6: With frm
7: .Caption = "CREATE SNIPPET:"
8: .lbOK.Caption = "TO CREATE"
8: .lbOK.Caption = "CREATE"
9: .txtRow = X + 1
10: .Show
11: End With
Expand All @@ -32,7 +32,7 @@ Option Explicit
23: Set snippets = SHSNIPPETS.ListObjects(C_Const.TB_SNIPPETS)
24: With frm
25: .Caption = "CHANGE SNIPPET:"
26: .lbOK.Caption = "TO CHANGE"
26: .lbOK.Caption = "CHANGE"
27: st = Split(snippets.ListColumns(3).Range(X, 1), ".")
28: .cmbENUM.Style = fmStyleDropDownCombo
29: .cmbENUM.Text = st(0)
Expand Down Expand Up @@ -63,7 +63,7 @@ errmsg:
54: If Err.Number = 91 Then
55: Err.Clear
56: Else
57: Debug.Print "Error in Deleterow!" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
57: Debug.Print "Error in Deleterow!" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
58: Call WriteErrorLog("DeletRow")
59: End If
60: End Sub
Expand All @@ -86,7 +86,7 @@ errmsg:
77: If Err.Number = 91 Then
78: Err.Clear
79: Else
80: Debug.Print "Error in TbAdd!" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
80: Debug.Print "Error in TbAdd!" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
81: Call WriteErrorLog("TbAdd")
82: End If
83: End Sub
4 changes: 2 additions & 2 deletions scripts/Modules/I_StatisticShape.bas
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Public Sub AddShapeStatistic()
13:
14: Set fForm = New AddStatistic
15: With fForm
16: .lbOK.Caption = "TO CREATE"
16: .lbOK.Caption = "CREATE"
17: .Show
18: wb_name = .cmbMain.Value
19: If wb_name = vbNullString Then Exit Sub
Expand Down Expand Up @@ -73,7 +73,7 @@ errmsg:
64: Resume Next
65: Else
66: Application.ScreenUpdating = True
67: Call MsgBox("Error in AddShapeStatistic" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl, vbCritical, "Error:")
67: Call MsgBox("Error in AddShapeStatistic" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl, vbCritical, "Error:")
68: Call WriteErrorLog("AddShapeStatistic")
69: End If
End Sub
4 changes: 2 additions & 2 deletions scripts/Modules/I_StatisticVBAProj.bas
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ errmsg:
57: Err.Clear
58: Resume Next
59: Else
60: Call MsgBox("Error in I_StatisticVBAProj.AddSheetStatistica" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl, vbCritical, "Error:")
60: Call MsgBox("Error in I_StatisticVBAProj.AddSheetStatistica" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl, vbCritical, "Error:")
61: Call WriteErrorLog("I_StatisticVBAProj.AddSheetStatistica")
62: End If
63: Application.DisplayAlerts = True
Expand Down Expand Up @@ -250,7 +250,7 @@ Err_msg_WSN:
241: Case 9:
242: Call MsgBox("Invalid value entered in the file name: [" & WorkSheetName & "] ", vbCritical, "Input error:")
243: Case Else:
244: Call MsgBox("Error in LastRowOrColumn:" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl, vbCritical, "Error:")
244: Call MsgBox("Error in LastRowOrColumn:" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl, vbCritical, "Error:")
245: Call WriteErrorLog("LastRowOrColumn")
246: End Select
247: End Function
Expand Down
2 changes: 1 addition & 1 deletion scripts/Modules/J_EditCode.bas
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Option Explicit
24: Exit Sub
ErrorHandler:
26: If Err.Number <> 91 Then
27: Debug.Print "Error in CutTab" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
27: Debug.Print "Error in CutTab" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
28: Call WriteErrorLog("CutTab")
29: End If
30: Err.Clear
Expand Down
4 changes: 2 additions & 2 deletions scripts/Modules/K_AddNumbersLine.bas
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ErrorHandler:
Case 91:
36: Exit Sub
37: Case Else:
38: Debug.Print "Error in PadlineNumbers_" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
38: Debug.Print "Error in PadlineNumbers_" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
39: Call WriteErrorLog("AddLineNumbers_")
40: End Select
41: Err.Clear
Expand All @@ -62,7 +62,7 @@ ErrorHandler:
Case 91:
62: Exit Sub
63: Case Else:
64: Debug.Print "Error in RemoveLineNumbers_" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
64: Debug.Print "Error in RemoveLineNumbers_" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
65: Call WriteErrorLog("RemoveLineNumbers_")
66: End Select
67: Err.Clear
Expand Down
4 changes: 2 additions & 2 deletions scripts/Modules/L_IndentRoutine.bas
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ErrorHandler:
Case 91:
89: Exit Sub
90: Case Else:
91: Debug.Print "Error in Rebuild" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line" & Erl
91: Debug.Print "Error in Rebuild" & vbLf & Err.Number & vbLf & Err.Description & vbCrLf & "in the line " & Erl
92: Call WriteErrorLog("ReBild")
93: End Select
94: Err.Clear
Expand Down Expand Up @@ -685,7 +685,7 @@ PTR_REPLACE_LINE:
674: 'And strip comments
675: i = InStr(1, sLine, "'")
676: If i > 0 Then sLine = Left$(sLine, i - 1)
677: ' Do we have a Then statement in the line. Adding a space on the
677: ' Do we have a Then statement in the line . Adding a space on the
678: ' end of the test means we can test for Then being both within or
679: ' at the end of the line
680: sLine = " " & sLine & " "
Expand Down
Loading

0 comments on commit 1528be3

Please sign in to comment.