Using the filesave dialog box

etpeterson

New Member
Joined
Jan 19, 2005
Messages
18
I have a spreadsheet that is a template. The user runs a macro to change the template and then needs to save the sheet elsewhere. I have a subroutine that looks like this:

Sub FileSave()
saveFile = Application.GetSaveAsFilename
End Sub


I call this at the end of my macro. How do I actually get excel to save the file?

Thanks,
Eric
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
saveFile = Application.GetSaveAsFilename
If saveFile <> False Then ActiveWorkbook.SaveAs (saveFile)

saveFile is just a variant variable containing the file name and path. The "If" statement checks to ensure that the user did not click cancel.
 
Upvote 0
May I add a question here?
When you choose an existing filename you will be asked to overwrite. When you then click "no" an error occurs.

Can you arrange that?
(I know it's illogic to first choose a name and then say now, but you know how users behave :confused: )

kind regards,
Erik
 
Upvote 0

Forum statistics

Threads
1,207,436
Messages
6,078,546
Members
446,346
Latest member
shinbum

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top