Maverick99
Board Regular
- Joined
- Feb 9, 2008
- Messages
- 108
I have run across some code that uses Case Statements, based upon a user's Button Selection from a UserForm. This is located in the UserForm Event Module.
I thought this would be straight forward to have it call a Sub "WriteToLog," if the Case Statement is true. However, it's not working for some reason. Does anyone know how this should be written. I have tried to just Call Sub, but does not work.
Thanks,
Maverick
I thought this would be straight forward to have it call a Sub "WriteToLog," if the Case Statement is true. However, it's not working for some reason. Does anyone know how this should be written. I have tried to just Call Sub, but does not work.
Code:
Private Sub Button1_Click()
Select Case Button1.Caption
Case "OK": UserClick = vbOK
Case "Cancel": UserClick = vbCancel
Case "Abort": UserClick = vbAbort
Case "Retry": UserClick = vbRetry
Case "Ignore": UserClick = vbIgnore
Case "Yes": UserClick = vbYes
Private Sub WriteToLog() 'Does Not Work, it expects End of Sub from the "Yes" Case
Call WriteToLog
Exit Sub
Case "No": UserClick = vbNo
End Select
Unload Me
End Sub
Maverick