Thread: Save As Macro
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Justin Larson[_2_] Justin Larson[_2_] is offline
external usenet poster
 
Posts: 26
Default Save As Macro

My first attempt at a simple VBA action. This post made it possible. Was
trying to figure out how to save as based on the value in a cell, and this
did the trick.

Thanks a ton.

-Liver

"Mike" wrote:

yyyy = Range("A2").Value
mmyyyy = Range("A3").Value
ActiveWorkbook.SaveAs Filename:="C:\FOLDER1\" & yyyy & "\" & mmyyyy &
"\MyFile.xls"

"iperlovsky" wrote:

I am running the following sub routine, but I would like the new file name to
incorporate a specific cell value so that the file will always be saved in
the most current folder.

Sub SaveAs()
ActiveWorkbook.SaveAs Filename:="N:\FOLDER1\MyFile.xls"
End Sub

For example, in the modified code below I would like folders {yyyy} and
{mm-yyyy} to reference cells A2 and A3, respectively, in a specific worksheet
in the active workbook.

ActiveWorkbook.SaveAs Filename:="N:\FOLDER1\{yyyy}\{mm-yyyy}\MyFile.xls"

Thanks for the help,

IP