ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forcing Save As: dialog box (https://www.excelbanter.com/excel-programming/312075-forcing-save-dialog-box.html)

swatsp0p[_2_]

Forcing Save As: dialog box
 
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
--
The older I get, the better I used to be.

Tom Ogilvy

Forcing Save As: dialog box
 
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.

--
Regards,
Tom Ogilvy


"swatsp0p" wrote in message
...
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
--
The older I get, the better I used to be.




swatsp0p[_2_]

Forcing Save As: dialog box
 
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

"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy


"swatsp0p" wrote in message
...
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
--
The older I get, the better I used to be.






All times are GMT +1. The time now is 11:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com