Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Insert Todays Date - 3 in file name

I have the following code which save a file from one directory to another and adds the date with each save:

ChDir "I:\EXLDATA\BatchTracking"
Workbooks.Open Filename:="I:\EXLDATA\BatchTracking\AttyPlace.xls"
ChDir "I:\EXLDATA\ATTYMGMT\Batch Tracking"
ActiveWorkbook.SaveAs Filename:= _
"I:\EXLDATA\ATTYMGMT\Batch Tracking\AttyPlace" & _
Format(Date, "yyyy-mm-dd") & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.Close
End Sub

I run the file on Monday, but would like it to save with Friday's date. Would it be possible to do something like TodaysDate - 3, or Date, "yyyy-mm-dd - 3"?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Insert Todays Date - 3 in file name

If you just want 3 days ago use

Format(Date-3, "yyyy-mm-dd")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Hargrove" wrote in message
...
I have the following code which save a file from one directory to another

and adds the date with each save:

ChDir "I:\EXLDATA\BatchTracking"
Workbooks.Open Filename:="I:\EXLDATA\BatchTracking\AttyPlace.xls"
ChDir "I:\EXLDATA\ATTYMGMT\Batch Tracking"
ActiveWorkbook.SaveAs Filename:= _
"I:\EXLDATA\ATTYMGMT\Batch Tracking\AttyPlace" & _
Format(Date, "yyyy-mm-dd") & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.Close
End Sub

I run the file on Monday, but would like it to save with Friday's date.

Would it be possible to do something like TodaysDate - 3, or Date,
"yyyy-mm-dd - 3"?


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 insert todays date in a spread sheet just prior to print wayne h Excel Worksheet Functions 2 May 25th 10 07:15 PM
Save file as todays date Rinto Syah Excel Discussion (Misc queries) 4 May 4th 09 11:39 AM
Save file with todays date ref#11235 [email protected] Excel Worksheet Functions 2 January 29th 09 06:59 PM
Saveing workbook to a file as todays date daily mikespeck Excel Worksheet Functions 0 August 22nd 06 01:27 PM
Saving a file with todays date on the end Tempy Excel Programming 6 April 19th 04 01:32 PM


All times are GMT +1. The time now is 06:33 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"