How do I write a macro that brings up a save as dialog and then c.

M

Menoh

I need to write a macro that brings up the save as dialog box, waits for the
user to enter in the name and location of the file, save it, and then
continue with the rest of the macro.
 
H

Helmut Weber

Hi Menoh,
like this:
Sub Test634()
Dim result As Integer
MsgBox "Macro Start"
result = Dialogs(wdDialogFileSaveAs).Show
If result = 0 Then
MsgBox "dialog cancelled"
Exit Sub
End If
MsgBox "Macro continued"
End Sub
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
P

Perry

Word/Office XP onward:

Dim fd As FileDialog
'< other lines of code
Set fd = Application.FileDialog(msoFileDialogSaveAs)
If fd.Show Then fd.Execute
'proceed with your code

Krgrds,
Perry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top