-
Marcke,
Here's code based upon your input:
In a standard module:
[vba]Option Explicit
Public bolBailOut as Boolean
Public strPWord as String, strUser as String, strDomain as String, strProject as String
Function YourFunction()
'...statements
frmExample.Show
If bolBailOut then Exit Function
'... other statements
End Function[/vba]
In the userform
[vba]Option Explicit
Private Sub cmdOKBttn_Click()
strPWord = txtPWord
strUser = txtUser
strDomain = txtDomain
strProject = txtProject
Unload Me
End Sub
Private Sub cmdCancelBttn_Click()
bolBailOut = True
Unload Me
End Sub[/vba]
Now that probably didn't help, did it? I figure you probably need some way of gracefully exiting the function if the user cancels. If this is the case, we'd need to see a bit more of what's going on to see what's needed. Make sense?
I do have one generic suggestion though , try calling the userform BEFORE getting into the function. Then call the function from the userform, with the args being passed as the values from the various text or other controls. If the user cancels or supplys bad vals, don't call the function. Does that help at all?
Hope to help,
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules