Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dolphinv4
 
Posts: n/a
Default Saving file in the format "YYMM"

Hi,

I am trying to get a macro to extract a date from a cell (A1), then save the
file in the format "YYMM Forecast".

May I know what is the code I should type in?

I tried the following but it doesn't work:

Dim myMonth as String
Dim myFileName as String

myMonth = Format("H71:J71", "yymm")
myFileName = "C:\" & myMonth & " Forecast.xls"

ActiveWorkbook.SaveAs Filename:=myFileName, FileFormat:=xlWorkbookNormal

Thanks.

  #2   Report Post  
Dan
 
Posts: n/a
Default

There is a "Range" missing in the code.

myMonth = Format(Range("H71"), "yymm")

"Dolphinv4" wrote:

Hi,

I am trying to get a macro to extract a date from a cell (A1), then save the
file in the format "YYMM Forecast".

May I know what is the code I should type in?

I tried the following but it doesn't work:

Dim myMonth as String
Dim myFileName as String

myMonth = Format("H71:J71", "yymm")
myFileName = "C:\" & myMonth & " Forecast.xls"

ActiveWorkbook.SaveAs Filename:=myFileName, FileFormat:=xlWorkbookNormal

Thanks.

  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

And why do you have 3 cells in your range:

myMonth = Format("H71:J71", "yymm")

That may affect the answer.

Dolphinv4 wrote:

Hi,

I am trying to get a macro to extract a date from a cell (A1), then save the
file in the format "YYMM Forecast".

May I know what is the code I should type in?

I tried the following but it doesn't work:

Dim myMonth as String
Dim myFileName as String

myMonth = Format("H71:J71", "yymm")
myFileName = "C:\" & myMonth & " Forecast.xls"

ActiveWorkbook.SaveAs Filename:=myFileName, FileFormat:=xlWorkbookNormal

Thanks.


--

Dave Peterson
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
How do I stop Excel from saving a file with a different name? Gary Excel Discussion (Misc queries) 5 September 14th 05 07:20 PM
Format of CSV File in export [email protected] Excel Worksheet Functions 4 September 8th 05 07:34 PM
File Saving with Text from File Mike Excel Discussion (Misc queries) 0 August 29th 05 09:47 PM
When I save a file I consistently get a message about saving a co. cynspin Excel Discussion (Misc queries) 2 February 1st 05 10:30 PM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM


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

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

About Us

"It's about Microsoft Excel"