ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Macro to "save as" (https://www.excelbanter.com/new-users-excel/240875-macro-save.html)

JS

Macro to "save as"
 
Hi,

Am using excel 2003 and am wanting to create a macro, attached to a button,
that will save as a particular cell #, say A2, and then print. Have the
print down pat, but can't figure out the save as part.......
--
Thanks for the help

Bernie Deitrick

Macro to "save as"
 
What is in cell A2? Try things like these, depending on what you have and what you want to do....

ThisWorkbook.SaveAs Range("A2").Value & ".xls"
ThisWorkbook.SaveCopyAs Range("A2").Value & ".xls"
ThisWorkbook.SaveAs "C:\Folder Path\" & Range("A2").Value & ".xls", AddToMru:=True
ThisWorkbook.SaveAs "C:\Folder Path\FileBaseName " & Format(Range("A2").Value, "yy-mm-dd") & ".xls"

HTH,
Bernie
MS Excel MVP


"JS" wrote in message
...
Hi,

Am using excel 2003 and am wanting to create a macro, attached to a button,
that will save as a particular cell #, say A2, and then print. Have the
print down pat, but can't figure out the save as part.......
--
Thanks for the help




JS

Macro to "save as"
 
Hi Bernie,

Thanks for your response. I enter a number into cell A2, and want excel to
save the worksheet as that number, and leave the original as the template.
--
Thanks again for the help


"Bernie Deitrick" wrote:

What is in cell A2? Try things like these, depending on what you have and what you want to do....

ThisWorkbook.SaveAs Range("A2").Value & ".xls"
ThisWorkbook.SaveCopyAs Range("A2").Value & ".xls"
ThisWorkbook.SaveAs "C:\Folder Path\" & Range("A2").Value & ".xls", AddToMru:=True
ThisWorkbook.SaveAs "C:\Folder Path\FileBaseName " & Format(Range("A2").Value, "yy-mm-dd") & ".xls"

HTH,
Bernie
MS Excel MVP


"JS" wrote in message
...
Hi,

Am using excel 2003 and am wanting to create a macro, attached to a button,
that will save as a particular cell #, say A2, and then print. Have the
print down pat, but can't figure out the save as part.......
--
Thanks for the help





Bernie Deitrick

Macro to "save as"
 
JS,

Then try using this - it will save in the same folder as the original template:

ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & Range("A2").Value & ".xls"

HTH,
Bernie
MS Excel MVP


"JS" wrote in message
...
Hi Bernie,

Thanks for your response. I enter a number into cell A2, and want excel to
save the worksheet as that number, and leave the original as the template.
--
Thanks again for the help


"Bernie Deitrick" wrote:

What is in cell A2? Try things like these, depending on what you have and what you want to do....

ThisWorkbook.SaveAs Range("A2").Value & ".xls"
ThisWorkbook.SaveCopyAs Range("A2").Value & ".xls"
ThisWorkbook.SaveAs "C:\Folder Path\" & Range("A2").Value & ".xls", AddToMru:=True
ThisWorkbook.SaveAs "C:\Folder Path\FileBaseName " & Format(Range("A2").Value, "yy-mm-dd") &
".xls"

HTH,
Bernie
MS Excel MVP


"JS" wrote in message
...
Hi,

Am using excel 2003 and am wanting to create a macro, attached to a button,
that will save as a particular cell #, say A2, and then print. Have the
print down pat, but can't figure out the save as part.......
--
Thanks for the help







JS

Macro to "save as"
 
Hey Bernie,

Thanks for all of your help! Works perfectly.
--
Cheers

"Bernie Deitrick" wrote:

JS,

Then try using this - it will save in the same folder as the original template:

ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & Range("A2").Value & ".xls"

HTH,
Bernie
MS Excel MVP


"JS" wrote in message
...
Hi Bernie,

Thanks for your response. I enter a number into cell A2, and want excel to
save the worksheet as that number, and leave the original as the template.
--
Thanks again for the help


"Bernie Deitrick" wrote:

What is in cell A2? Try things like these, depending on what you have and what you want to do....

ThisWorkbook.SaveAs Range("A2").Value & ".xls"
ThisWorkbook.SaveCopyAs Range("A2").Value & ".xls"
ThisWorkbook.SaveAs "C:\Folder Path\" & Range("A2").Value & ".xls", AddToMru:=True
ThisWorkbook.SaveAs "C:\Folder Path\FileBaseName " & Format(Range("A2").Value, "yy-mm-dd") &
".xls"

HTH,
Bernie
MS Excel MVP


"JS" wrote in message
...
Hi,

Am using excel 2003 and am wanting to create a macro, attached to a button,
that will save as a particular cell #, say A2, and then print. Have the
print down pat, but can't figure out the save as part.......
--
Thanks for the help








All times are GMT +1. The time now is 07:21 AM.

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