mtroche
Civil/Environmental
- Jun 4, 2001
- 39
I want to store some data to a Public Array but the following Error Message appears:
"Complie error
Constants, fixed-length strings, arrays, user-defined types
and Declare statements not allowed as Public memebers of object modules."
I am using a UserForm to get the information at first time and, then, call the information from the array as needed. What is the problem with my code? :-( Below you can see the code related with my problem.
Public dd1
Public Data(1 To 100, 1 To 100, 1 To 14)
____________________________________________________________
Private Sub Calculate_Click()
Static d1
If SmallerPole = "" Or HigherPole = "" Or _
Spacing = "" Or ElevationS = "" Or ElevationH = "" Then
MsgBox "All Fields in 'Poles in Span' Must Be _
Filled.", vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(HigherPole) = False Or _
IsNumeric(SmallerPole) = False Then
MsgBox "The IDs for Pole #1 and #2 must be Numbers.", _
vbInformation, "Check"
GoTo 10
ElseIf SmallerPole > HigherPole Or _
SmallerPole = HigherPole Or _
SmallerPole < 0 Or HigherPole < 0 Then
MsgBox "Verify that the ID Number for Pole #1 is _
smaller than the ID Number for Pole #2 and _
that both of them are positive.", _
vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(Spacing) = False Or _
IsNumeric(ElevationS) = False Or _
IsNumeric(ElevationH) = False Then
MsgBox "Input Numeric Data for the Spacing, _
Elevation #1 and Elevation #2.", _
vbInformation, "Check"
GoTo 10
ElseIf Clearance = "" And HT = "" Then
MsgBox "Fill the Clearance or the Horizontal _
Tension to Start the Calculations.", _
vbInformation, "Check"
GoTo 10
ElseIf Clearance <> "" And HT <> "" Then
MsgBox "Just Fill the Clearance or the Horizontal _
Tension. Do Not Fill Both of Them.", _
vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(Clearance) = False And HT = "" Then
MsgBox "Input Numeric Data for the Clearance.", vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(HT) = False And Clearance = "" Then
MsgBox "Input Numeric Data for the Horizontal _
Tension.", vbInformation, "Check"
GoTo 10
End If
d1 = d1 + 1
Data(d1, 1, 1) = SmallerPole
Data(d1, 1, 2) = HigherPole
Data(d1, 1, 3) = Spacing
Data(d1, 1, 4) = ElevationS
Data(d1, 1, 5) = ElevationH
Data(d1, 1, 6) = Clearance
Data(d1, 1, 7) = HT
Data(d1, 2, 1) = CodeWord1
Data(d1, 2, 2) = CodeWord2
Data(d1, 2, 3) = CodeWord3
Data(d1, 2, 4) = CodeWord4
Data(d1, 2, 5) = CodeWord5
Data(d1, 2, 6) = CodeWord6
Data(d1, 2, 7) = CodeWord7
Data(d1, 2, 8) = CodeWord8
Data(d1, 2, 9) = CodeWord9
Data(d1, 2, 10) = CodeWor10
Data(d1, 2, 11) = CodeWord11
Data(d1, 2, 12) = CodeWord12
Data(d1, 2, 13) = CodeWord13
Data(d1, 2, 14) = CodeWord14
Data(d1, 3, 1) = Quantity1
Data(d1, 3, 2) = Quantity2
Data(d1, 3, 3) = Quantity3
Data(d1, 3, 4) = Quantity4
Data(d1, 3, 5) = Quantity5
Data(d1, 3, 6) = Quantity6
Data(d1, 3, 7) = Quantity7
Data(d1, 3, 8) = Quantity8
Data(d1, 3, 9) = Quantity9
Data(d1, 3, 10) = Quantity10
Data(d1, 3, 11) = Quantity11
Data(d1, 3, 12) = Quantity12
Data(d1, 3, 13) = Quantity13
Data(d1, 3, 14) = Quantity14
Data(d1, 4, 1) = Delta1
Data(d1, 4, 2) = Delta2
Data(d1, 4, 3) = Delta3
Data(d1, 4, 4) = Delta4
Data(d1, 4, 5) = Delta5
Data(d1, 4, 6) = Delta6
Data(d1, 4, 7) = Delta7
Data(d1, 4, 8) = Delta8
Data(d1, 4, 9) = Delta9
Data(d1, 4, 10) = Delta10
Data(d1, 4, 11) = Delta11
Data(d1, 4, 12) = Delta12
Data(d1, 4, 13) = Delta13
Data(d1, 4, 14) = Delta14
dd1 = d1
10
End Sub
____________________________________________________________
Private Sub Spacing_Change()
Dim n As Byte
For n = 1 To dd1
If Data(n, 1, 1) = SmallerPole And _
Data(n, 1, 2) = HigherPole Then
Spacing.Value = Data(n, 1, 3)
End Sub
End If
Next n
End Sub
"Complie error
Constants, fixed-length strings, arrays, user-defined types
and Declare statements not allowed as Public memebers of object modules."
I am using a UserForm to get the information at first time and, then, call the information from the array as needed. What is the problem with my code? :-( Below you can see the code related with my problem.
Public dd1
Public Data(1 To 100, 1 To 100, 1 To 14)
____________________________________________________________
Private Sub Calculate_Click()
Static d1
If SmallerPole = "" Or HigherPole = "" Or _
Spacing = "" Or ElevationS = "" Or ElevationH = "" Then
MsgBox "All Fields in 'Poles in Span' Must Be _
Filled.", vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(HigherPole) = False Or _
IsNumeric(SmallerPole) = False Then
MsgBox "The IDs for Pole #1 and #2 must be Numbers.", _
vbInformation, "Check"
GoTo 10
ElseIf SmallerPole > HigherPole Or _
SmallerPole = HigherPole Or _
SmallerPole < 0 Or HigherPole < 0 Then
MsgBox "Verify that the ID Number for Pole #1 is _
smaller than the ID Number for Pole #2 and _
that both of them are positive.", _
vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(Spacing) = False Or _
IsNumeric(ElevationS) = False Or _
IsNumeric(ElevationH) = False Then
MsgBox "Input Numeric Data for the Spacing, _
Elevation #1 and Elevation #2.", _
vbInformation, "Check"
GoTo 10
ElseIf Clearance = "" And HT = "" Then
MsgBox "Fill the Clearance or the Horizontal _
Tension to Start the Calculations.", _
vbInformation, "Check"
GoTo 10
ElseIf Clearance <> "" And HT <> "" Then
MsgBox "Just Fill the Clearance or the Horizontal _
Tension. Do Not Fill Both of Them.", _
vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(Clearance) = False And HT = "" Then
MsgBox "Input Numeric Data for the Clearance.", vbInformation, "Check"
GoTo 10
ElseIf IsNumeric(HT) = False And Clearance = "" Then
MsgBox "Input Numeric Data for the Horizontal _
Tension.", vbInformation, "Check"
GoTo 10
End If
d1 = d1 + 1
Data(d1, 1, 1) = SmallerPole
Data(d1, 1, 2) = HigherPole
Data(d1, 1, 3) = Spacing
Data(d1, 1, 4) = ElevationS
Data(d1, 1, 5) = ElevationH
Data(d1, 1, 6) = Clearance
Data(d1, 1, 7) = HT
Data(d1, 2, 1) = CodeWord1
Data(d1, 2, 2) = CodeWord2
Data(d1, 2, 3) = CodeWord3
Data(d1, 2, 4) = CodeWord4
Data(d1, 2, 5) = CodeWord5
Data(d1, 2, 6) = CodeWord6
Data(d1, 2, 7) = CodeWord7
Data(d1, 2, 8) = CodeWord8
Data(d1, 2, 9) = CodeWord9
Data(d1, 2, 10) = CodeWor10
Data(d1, 2, 11) = CodeWord11
Data(d1, 2, 12) = CodeWord12
Data(d1, 2, 13) = CodeWord13
Data(d1, 2, 14) = CodeWord14
Data(d1, 3, 1) = Quantity1
Data(d1, 3, 2) = Quantity2
Data(d1, 3, 3) = Quantity3
Data(d1, 3, 4) = Quantity4
Data(d1, 3, 5) = Quantity5
Data(d1, 3, 6) = Quantity6
Data(d1, 3, 7) = Quantity7
Data(d1, 3, 8) = Quantity8
Data(d1, 3, 9) = Quantity9
Data(d1, 3, 10) = Quantity10
Data(d1, 3, 11) = Quantity11
Data(d1, 3, 12) = Quantity12
Data(d1, 3, 13) = Quantity13
Data(d1, 3, 14) = Quantity14
Data(d1, 4, 1) = Delta1
Data(d1, 4, 2) = Delta2
Data(d1, 4, 3) = Delta3
Data(d1, 4, 4) = Delta4
Data(d1, 4, 5) = Delta5
Data(d1, 4, 6) = Delta6
Data(d1, 4, 7) = Delta7
Data(d1, 4, 8) = Delta8
Data(d1, 4, 9) = Delta9
Data(d1, 4, 10) = Delta10
Data(d1, 4, 11) = Delta11
Data(d1, 4, 12) = Delta12
Data(d1, 4, 13) = Delta13
Data(d1, 4, 14) = Delta14
dd1 = d1
10
End Sub
____________________________________________________________
Private Sub Spacing_Change()
Dim n As Byte
For n = 1 To dd1
If Data(n, 1, 1) = SmallerPole And _
Data(n, 1, 2) = HigherPole Then
Spacing.Value = Data(n, 1, 3)
End Sub
End If
Next n
End Sub