-
Notifications
You must be signed in to change notification settings - Fork 2
/
WorksheetRoutines.bas
117 lines (86 loc) · 3.34 KB
/
WorksheetRoutines.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Attribute VB_Name = "WorksheetRoutines"
'@Folder("TableManager.Worksheets")
Option Explicit
Private Const Module_Name As String = "WorksheetRoutines."
Private pAllShts As WorksheetsClass
Private Function ModuleList() As Variant
ModuleList = Array("XLAM_Module.", "TableRoutines.", "WorksheetsClass.")
End Function ' ModuleList
Public Sub RemoveWorksheet(ByVal WkShtName As String)
pAllShts.Remove WkShtName, Module_Name
End Sub
Public Sub WorksheetAdd( _
ByVal WS As Variant, _
ByVal ModuleName As String)
Const RoutineName As String = Module_Name & "WorksheetAdd"
On Error GoTo ErrorHandler
Debug.Assert InScope(ModuleList, ModuleName)
pAllShts.Add WS, ModuleName
'@Ignore LineLabelNotUsed
Done:
Exit Sub
ErrorHandler:
RaiseError Err.Number, Err.Source, RoutineName, Err.Description
End Sub ' WorksheetAdd
Public Sub WorksheetSetNewClass(ByVal ModuleName As String)
Const RoutineName As String = Module_Name & "WorksheetSetNewClass"
On Error GoTo ErrorHandler
Debug.Assert InScope(ModuleList, ModuleName)
Set pAllShts = New WorksheetsClass
'@Ignore LineLabelNotUsed
Done:
Exit Sub
ErrorHandler:
RaiseError Err.Number, Err.Source, RoutineName, Err.Description
End Sub ' WorksheetSetNewClass
Public Sub WorksheetSetNothing(ByVal ModuleName As String)
Const RoutineName As String = Module_Name & "WorksheetSetNothing"
On Error GoTo ErrorHandler
Debug.Assert InScope(ModuleList, ModuleName)
Set pAllShts = Nothing
'@Ignore LineLabelNotUsed
Done:
Exit Sub
ErrorHandler:
RaiseError Err.Number, Err.Source, RoutineName, Err.Description
End Sub ' WorksheetSetNothing
Public Sub WorksheetSetNewDict(ByVal ModuleName As String)
' Used in WorksheetsClass
Const RoutineName As String = Module_Name & "WorksheetSetNewDict"
On Error GoTo ErrorHandler
Debug.Assert InScope(ModuleList, ModuleName)
Set pAllShts = New Scripting.Dictionary
'@Ignore LineLabelNotUsed
Done:
Exit Sub
ErrorHandler:
RaiseError Err.Number, Err.Source, RoutineName, Err.Description
End Sub ' WorksheetSetNewDict
Public Function WorksheetExists( _
ByVal Sht As Variant, _
ByVal ModuleName As String _
) As Boolean
Const RoutineName As String = Module_Name & "WorksheetExists"
On Error GoTo ErrorHandler
Debug.Assert InScope(ModuleList, ModuleName)
WorksheetExists = pAllShts.Exists(Sht, Module_Name)
'@Ignore LineLabelNotUsed
Done:
Exit Function
ErrorHandler:
RaiseError Err.Number, Err.Source, RoutineName, Err.Description
End Function ' WorksheetExists
Public Sub WorksheetRemove( _
ByVal Val As Variant, _
ByVal ModuleName As String)
' Used in TableRoutines, WorksheetsClass
Const RoutineName As String = Module_Name & "WorksheetRemove"
On Error GoTo ErrorHandler
Debug.Assert InScope(ModuleList, ModuleName)
pAllShts.Remove Val, Module_Name
'@Ignore LineLabelNotUsed
Done:
Exit Sub
ErrorHandler:
RaiseError Err.Number, Err.Source, RoutineName, Err.Description
End Sub ' WorksheetRemove