ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save As (https://www.excelbanter.com/excel-programming/423090-save.html)

Dave

Save As
 
Hi,
XL2003
I am trying to do a SaveAs according to inputs entered by the op.
Two questions are asked, answers are Ans1 and Ans2
If I use: ActiveWorkbook.SaveAs Filename:=Ans1 & " " & Ans2
Then the workbook is saved correctly, but to the default location. I want
the op to be able to choose the location, but for the constructed filename to
be already present in the SaveAs dialogue box.
I tried: Application.GetSaveAsFilename (Ans1 & " " & Ans2)
which looked promising, allowing me to select the destination. But after
clicking Save, although the SaveAs dialogue box closed and the macro resumed,
the workbook was not actually saved.
Is there a syntax that will do what I want?
Thanks in advance.
Regards - Dave.


JLGWhiz

Save As
 
Dave, I believe that when you call the SaveAs dialog box with VBA that it
only allows you to return a path and filename. It doesn't do anything with
it. So, you need to add a line of code that executes after you click OK save
the ActiveWorkbook.

"Dave" wrote:

Hi,
XL2003
I am trying to do a SaveAs according to inputs entered by the op.
Two questions are asked, answers are Ans1 and Ans2
If I use: ActiveWorkbook.SaveAs Filename:=Ans1 & " " & Ans2
Then the workbook is saved correctly, but to the default location. I want
the op to be able to choose the location, but for the constructed filename to
be already present in the SaveAs dialogue box.
I tried: Application.GetSaveAsFilename (Ans1 & " " & Ans2)
which looked promising, allowing me to select the destination. But after
clicking Save, although the SaveAs dialogue box closed and the macro resumed,
the workbook was not actually saved.
Is there a syntax that will do what I want?
Thanks in advance.
Regards - Dave.


JLGWhiz

Save As
 
To clarify:

fName = Application.GetSaveAs Filename:=Ans1 & " " & Ans2
fName.Save

"Dave" wrote:

Hi,
XL2003
I am trying to do a SaveAs according to inputs entered by the op.
Two questions are asked, answers are Ans1 and Ans2
If I use: ActiveWorkbook.SaveAs Filename:=Ans1 & " " & Ans2
Then the workbook is saved correctly, but to the default location. I want
the op to be able to choose the location, but for the constructed filename to
be already present in the SaveAs dialogue box.
I tried: Application.GetSaveAsFilename (Ans1 & " " & Ans2)
which looked promising, allowing me to select the destination. But after
clicking Save, although the SaveAs dialogue box closed and the macro resumed,
the workbook was not actually saved.
Is there a syntax that will do what I want?
Thanks in advance.
Regards - Dave.


Dave

Save As
 
Hi JLG,
Yes, that did it. Thanks.
Regards - Dave.


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

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