austenr
11-10-2004, 01:10 PM
This code is at the end of a routine that executes before close. I want to display the user form and then call the routine that the user can choose to execute several choices. When I try to compile the code, I get a message that says "OptionButton1 not defined". Do I have to define it again? It is defined of course in the User Form.
If RngStr <> "" Then
MsgBox Prompt & RngStr, vbCritical, "Incomplete Data"
Cancel = True
Else
UserForm2.Show
Call CommandButton1_Click
Cancel = False
End If
Here is the code for the User Form:
Private Sub CommandButton1_Click()
If OptionButton1 = True Then
MsgBox "Saving Workbook"
ActiveWorkbook.Save
Unload Me
End If
If OptionButton2 = True Then
MsgBox " Saving and Printing All Active Worksheets..."
ActiveWorkbook.Save
Sheets.PrintOut
Unload Me
End If
End Sub
If RngStr <> "" Then
MsgBox Prompt & RngStr, vbCritical, "Incomplete Data"
Cancel = True
Else
UserForm2.Show
Call CommandButton1_Click
Cancel = False
End If
Here is the code for the User Form:
Private Sub CommandButton1_Click()
If OptionButton1 = True Then
MsgBox "Saving Workbook"
ActiveWorkbook.Save
Unload Me
End If
If OptionButton2 = True Then
MsgBox " Saving and Printing All Active Worksheets..."
ActiveWorkbook.Save
Sheets.PrintOut
Unload Me
End If
End Sub