JasonLeVan
Board Regular
- Joined
- Feb 7, 2011
- Messages
- 121
Is there a way to have a message box pop up but continue running the rest of my macro
UserForm1.Show vbModeless
Public Sub test()
Dim objWShell As Object, i
Set objWShell = CreateObject("Wscript.Shell")
objWShell.Popup "Boo!", 2
'rest of macro
MsgBox "done"
End Sub
Jason,
The important term you want to know is 'Modal.' A modal form or dialog is one that is going to cause it's parent to stop running until its own process is finished (sorry if you knew that already).
I am pretty confident that that VBA msgbox is always modal. There's no way to put one on the screen and have the macro that created it continue running.
However, Userforms can be non-modal. You can set up a userform to look a lot like a msgbox, if you want.
Code:UserForm1.Show vbModeless
There may be better solutions, but this is how I'd do it. Remeber that you'll have to figure out when you want the userform to go away and either hide or unload it as necessary.
'from somewhere other than the userform
Userform1.Hide
'from the code launched from the form itself (like a button event)
Me.Hide
'from somewhere other than the userform
Unload Userform1
'from the code launched from the form itself (like a button event)
Unload Me