Forcing Save As: dialog box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have tried "application.ActiveWorkbook.SaveAs" to force the user to rename
and save the file upon completion of the macro. However, this command simply
saves the file to the default location with the same name as it when opened.
What am I missing?

Specifically, I want this command to be the last statement in the module
that will open the File Save As... dialog box, allow the user to select the
location and name the file, perform the Save and end the macro, returning
control to the user.

This macro will be universal, as the original file name will vary each time,
as will the Save As name.

Thanks for any input on this.

Bruce
swatsp0p
 
Dim fName as Boolean
fname = Application.GetSaveAsfileName()
if fName <> False then
ActiveWorkbook.SaveAs filename:=fName
Else
msgbox "You hit cancel"
End if

See Excel vba help on GetSaveAsFileName for some argument options.
 
Thanks, Tom. Much more to it than just "Save As..." !! I looked in Help,
but didn't try "GetSaveAs...."... oh well.

Thanks again for your quick response. (I'll be a hero here for finishing
this project)

swatsp0p
 

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

Back
Top