[RESOLVED] MS Word: need help creating msgbox (save, run, cancel)?
How do I create a msg before running macro? I want to have 3 options within the msgbox, "save & run macro", "run macro" and "cancel".
If the user has not saved, the msgbox should ask if they want to save and then run the macro, or just run the macro or just cancel out.
Thanks in advance.
Also, Im using Word.
Re: need help creating msgbox (save, run, cancel)?
Re: need help creating msgbox (save, run, cancel)?
with Word, its VBA i believe, yes.
Re: need help creating msgbox (save, run, cancel)?
Quote:
Originally Posted by ChootarLaal
with Word, its VBA i believe, yes.
You were talking about macros so I figured it was either Excel VBA or Word VBA.
Anyway, this is the section for this type of question. :)
Moved to Office Development
Re: need help creating msgbox (save, run, cancel)?
Please advise if this is the correct and the most efficient way of doing this.
1. Create a UserForm1 and then call it as soon as the macro is run?
2. Within the UserForm1 I will have 3 buttons, "Save & Run", "Run" and "Cancel.
3. Tie those 3 buttons to the respective functions.
3a. I dont know what the function calls for those are.
Re: need help creating msgbox (save, run, cancel)?
You cant use the default MsgBox? vbYesNoCancel?
Re: need help creating msgbox (save, run, cancel)?
Re: need help creating msgbox (save, run, cancel)?
Just one way:
VB Code:
Dim lRet As Long
lRet = MsgBox("Do you want to Save & Run (Yes) or Run (No) the Macro?", vbYesNoCancel + vbQuestion)
If lRet = vbYes Then
'Save and Run
ElseIf lRet = vbNo Then
'Run
Else
'Cancel
End If
Re: need help creating msgbox (save, run, cancel)?
ok, great. but what are the commands for save and run, run and cancel?
edit:
actually, i know how to run, just call that particular function. but how would i save? is there a save function?
Re: MS Word: need help creating msgbox (save, run, cancel)?
What Macro? Why does it need to be saved? Are they recording a Macro or something? Need a little more info please. ;)
Re: MS Word: need help creating msgbox (save, run, cancel)?
i want to prompt the users to save their work before running the macro, or just run the macro or just cancel.
sorry to be so vague.
Re: MS Word: need help creating msgbox (save, run, cancel)?
ok, this is resolved, im calling "ActiveDocument.Save" and then the macro is being called to run. thanks a lot all.