|
-
Jan 26th, 2006, 02:20 PM
#1
Thread Starter
Junior Member
[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.
Last edited by ChootarLaal; Jan 26th, 2006 at 03:05 PM.
-
Jan 26th, 2006, 02:21 PM
#2
Re: need help creating msgbox (save, run, cancel)?
-
Jan 26th, 2006, 02:23 PM
#3
Thread Starter
Junior Member
Re: need help creating msgbox (save, run, cancel)?
with Word, its VBA i believe, yes.
-
Jan 26th, 2006, 02:24 PM
#4
Re: need help creating msgbox (save, run, cancel)?
 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
-
Jan 26th, 2006, 02:40 PM
#5
Thread Starter
Junior Member
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.
-
Jan 26th, 2006, 02:44 PM
#6
Re: need help creating msgbox (save, run, cancel)?
You cant use the default MsgBox? vbYesNoCancel?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 26th, 2006, 02:51 PM
#7
Thread Starter
Junior Member
Re: need help creating msgbox (save, run, cancel)?
-
Jan 26th, 2006, 02:56 PM
#8
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 26th, 2006, 03:00 PM
#9
Thread Starter
Junior Member
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?
Last edited by ChootarLaal; Jan 26th, 2006 at 03:05 PM.
-
Jan 26th, 2006, 03:06 PM
#10
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 26th, 2006, 03:10 PM
#11
Thread Starter
Junior Member
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.
Last edited by ChootarLaal; Jan 26th, 2006 at 03:17 PM.
-
Jan 26th, 2006, 04:08 PM
#12
Thread Starter
Junior Member
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.
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
|
Click Here to Expand Forum to Full Width
|