-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclsVar.cls
More file actions
69 lines (65 loc) · 2.19 KB
/
clsVar.cls
File metadata and controls
69 lines (65 loc) · 2.19 KB
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
Option Explicit
Private DynWDVar() As WDVar
Private Type WDVar
Name As String
Value As String
End Type
Private Function IsInit() As Boolean
On Error GoTo Die
Dim i As Integer
i = UBound(DynWDVar)
Die:
If Err.Number = 0 Then IsInit = True
End Function
Private Function GetVar(ByVal StringName As String) As String
Dim i As Integer
If Not IsInit Then Exit Function
For i = 0 To UBound(DynWDVar) Step 1
If DynWDVar(i).Name = StringName Then
GetVar = DynWDVar(i).Value
Exit For
End If
Next i
End Function
Private Sub SetVar(ByVal StringName As String, ByVal StringValue As String)
Dim i As Integer, IsExist As Boolean
IsExist = False
If IsInit Then
For i = 0 To UBound(DynWDVar) Step 1
If DynWDVar(i).Name = StringName Then
DynWDVar(i).Value = StringValue
IsExist = True
Exit For
End If
Next i
If Not IsExist Then ReDim Preserve DynWDVar(UBound(DynWDVar) + 1)
Else
ReDim DynWDVar(0)
End If
If Not IsExist Then
DynWDVar(UBound(DynWDVar)).Name = StringName
DynWDVar(UBound(DynWDVar)).Value = StringValue
End If
End Sub
Public Property Get rValue(ByVal Index As String) As String
Dim i As Long: i = 4
While shGUI.Range("J" & i).Value <> ""
Dim j As Long: j = 4
Dim Multiple As Boolean: Multiple = False
While shGUI.Range("J" & j).Value <> "" And Not Multiple
If shGUI.Range("J" & i).Value = shGUI.Range("J" & j).Value Then Multiple = True
j = j + 1
Wend
If Multiple Then
If shGUI.Range("J" & i).Interior.Color = vbGreen Then
rValue = shGUI.Range("K" & i).Value
End If
Else
rValue = shGUI.Range("K" & i).Value
End If
i = i + 1
Wend
End Property
Public Property Get Value(ByVal Index As String) As String: Value = GetVar(Index): End Property
Public Property Let Value(ByVal Index As String, ByVal ValueString As String): Call SetVar(Index, ValueString): End Property
Public Property Get lValue(ByVal Index As String) As Long: lValue = CLng(GetVar(Index)): End Property