DwayneS
Instructor
- Mar 29, 2002
- 70
Novice programmer; having problem with simple code routine.
I have an input form written and it works. I have subs written to do perform appropriate print routines.
I can't get call to work. Error says "Expected sub, function, or property" I must have made a rookie coding error. Can anyone help?
Here's the code that won't work:
Sub CommandButton1_Click()
Dim x As Integer
Dim RepToPrint As String
For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) = True Then
RepToPrint = ListBox1.List(x)
' Using this line just to confirm that the loop
' is working. It works
MsgBox ListBox1.List(x)
' I can't get either of these following lines to work
' I have written subs named the same as the values of the UserForm
' and the subs work.
' Call RepToPrint
' Call ListBox1.List(x).Value
End If
Next x
' Close the UserForm.
Unload Me
End Sub
Dwayne Streeter, CPA, CITP
I have an input form written and it works. I have subs written to do perform appropriate print routines.
I can't get call to work. Error says "Expected sub, function, or property" I must have made a rookie coding error. Can anyone help?
Here's the code that won't work:
Sub CommandButton1_Click()
Dim x As Integer
Dim RepToPrint As String
For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) = True Then
RepToPrint = ListBox1.List(x)
' Using this line just to confirm that the loop
' is working. It works
MsgBox ListBox1.List(x)
' I can't get either of these following lines to work
' I have written subs named the same as the values of the UserForm
' and the subs work.
' Call RepToPrint
' Call ListBox1.List(x).Value
End If
Next x
' Close the UserForm.
Unload Me
End Sub
Dwayne Streeter, CPA, CITP