PDA

View Full Version : UserForm within procedure - help



crugg
02-24-2009, 11:55 AM
Hello -

Trying to do something seemingly easy here.

I have macro code within which, when the macro gets to a certain point in teh code, I want to launch a userform with 2 command buttons. Click one and the macro stops. Click the other and the macro continues.

I have the form set up and know how to launch it. Looking for help on where/how to set up the commands to either exit the macro or continue.

Thanks!

Bob Phillips
02-24-2009, 12:03 PM
'some code

With UserForm1

.Show
If .Cancel Then Exit Sub
End With

' more code


and in the form



Option Explicit

Private mcCancel As Boolean

Public Property Get Cancel() As boolena
Cancel = mcCancel
End Property

Private Sub cmdOK_Click()
mcCancel = False
Me.Hide
End Sub

Private Sub cmdQuit_Click()
mcCancel = True
Me.Hide
End Sub

Private Sub UserForm_Activate()
mcCancel = False
End Sub