Dear all, I have tried looking at existing posts but so far nothing works
I have a user form that has an OK and Cancel button. When I click on cancel, the form unloads but still moves onto the remaining part of the code. I have tried the following without success
In my main module
In the userform, when clicking Cancel
In addition to this
In my main code back in the module
Is there something I have missed ?
I have a user form that has an OK and Cancel button. When I click on cancel, the form unloads but still moves onto the remaining part of the code. I have tried the following without success
In my main module
Code:
Public cancflg as boolean
--------------------------------------------------------------
Sub cancelflag(cancl as boolean)
canclflg = cancel
End sub
--------------------------------------------------------------
In the userform, when clicking Cancel
Code:
Private Sub CommandButton1_Click
Call cancelflag(true)
Unload me
End sub
In addition to this
Code:
Private Sub Userform_Initialize()
Call Cancelflag(False)
End Sub
In my main code back in the module
Code:
FrmInput.show
If Cancelflag = True then
Exit sub
End if
Is there something I have missed ?