ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I save a spreadsheet from a macro? (https://www.excelbanter.com/excel-discussion-misc-queries/133358-how-do-i-save-spreadsheet-macro.html)

Cortez

How do I save a spreadsheet from a macro?
 
I need to create a macro to "save as" the spreadsheet to a specific
folder, with a unique (date/time based) file name.

Is there a "save as" command that can be used from a macro so that
this can be done? I can sort out the file naming procedure, unless
you have any suggestions on that as well.

Thanks,

TK


Gary''s Student

How do I save a spreadsheet from a macro?
 
For example:

Sub cortez()
s1 = "C:\Documents and Settings\User\Desktop"
s2 = "\Bookx"
s3 = Format(Now(), "mm_dd_yyyy") & ".xls"

ChDir s1
ActiveWorkbook.SaveAs Filename:=s1 & s2 & s3
End Sub


--
Gary''s Student
gsnu200709


"Cortez" wrote:

I need to create a macro to "save as" the spreadsheet to a specific
folder, with a unique (date/time based) file name.

Is there a "save as" command that can be used from a macro so that
this can be done? I can sort out the file naming procedure, unless
you have any suggestions on that as well.

Thanks,

TK



Cortez

How do I save a spreadsheet from a macro?
 
On Mar 5, 10:45 am, Gary''s Student
wrote:
For example:

Sub cortez()
s1 = "C:\Documents and Settings\User\Desktop"
s2 = "\Bookx"
s3 = Format(Now(), "mm_dd_yyyy") & ".xls"

ChDir s1
ActiveWorkbook.SaveAs Filename:=s1 & s2 & s3
End Sub

--

I came back to reply that I found it:

ActiveWorkbook.SaveAs Filename:="etc"

and saw that you gave me the whole thing. Thank you very much.

TK

Gary''s Student
gsnu200709

"Cortez" wrote:
I need to create a macro to "save as" the spreadsheet to a specific
folder, with a unique (date/time based) file name.


Is there a "save as" command that can be used from a macro so that
this can be done? I can sort out the file naming procedure, unless
you have any suggestions on that as well.


Thanks,


TK





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

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