Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Save As Macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Save As Macro

Hi,

SaveAs is an illegal sub name. Try this for your saveas line

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

Mike

"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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Save As Macro

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Save As Macro

Range("A2") is a date and I want to use just the year from it for yyyy. I
tried this Text(Year(Range("B6").Value), "0000") but received an error.

Also, Range("A3") is a date which I want to be month-year for mmyyyy. I
tried this Text(Range("B6").Value), "mm-yyyy") but received an error.

any suggestions?

"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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Save As Macro

Sub doit()
yyyy = Format(Range("A2").Value, "yyyy")
mmyyyy = Format(Range("A3").Value, "mm-yyyy")
ActiveWorkbook.SaveAs Filename:="C:\FOLDER1\" & yyyy & "\" & mmyyyy &
"\MyFile.xls"
End Sub
"iperlovsky" wrote:

Range("A2") is a date and I want to use just the year from it for yyyy. I
tried this Text(Year(Range("B6").Value), "0000") but received an error.

Also, Range("A3") is a date which I want to be month-year for mmyyyy. I
tried this Text(Range("B6").Value), "mm-yyyy") but received an error.

any suggestions?

"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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Save As Macro

Try this:

MyYear = Year(Range("A2").Value)
mmYY = Format((Range("A3").Value), "mm-yyyy")
MySaveAsFileName = "N:\FOLDER1\" & MyYear & "\" & mmYY & "\MyFile.xls"
ActiveWorkbook.SaveAs Filename:=MySaveAsFileName

Regards,
Per

"iperlovsky" skrev i meddelelsen
...
Range("A2") is a date and I want to use just the year from it for yyyy. I
tried this Text(Year(Range("B6").Value), "0000") but received an error.

Also, Range("A3") is a date which I want to be month-year for mmyyyy. I
tried this Text(Range("B6").Value), "mm-yyyy") but received an error.

any suggestions?

"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


  #7   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM
"Save" macro problem, still prompted to save when closing workbook (?) StargateFanFromWork[_4_] Excel Programming 8 September 13th 06 04:49 PM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM
ASP: Open Excel File with Macro, Allow Macro to run, and then save delgados129 Excel Programming 0 March 10th 05 09:35 PM
Prompted to save changes after macro save - why? Izar Arcturus Excel Programming 2 December 10th 03 09:27 PM


All times are GMT +1. The time now is 02:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"