ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving a file with todays date on the end (https://www.excelbanter.com/excel-programming/295132-saving-file-todays-date-end.html)

Tempy

Saving a file with todays date on the end
 
Hi,

Could somebody please help me with some code to save a file, with a
standard file name, but with todays date on the end. e.g.
Combined_14.04.04.xls

Thanks in advance.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Bob Phillips[_6_]

Saving a file with todays date on the end
 
ACtiveWorkbook.SaveAs Filename:="Combined_" & Format(Date,"yy.mm.dd")

--

HTH

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

"Tempy" wrote in message
...
Hi,

Could somebody please help me with some code to save a file, with a
standard file name, but with todays date on the end. e.g.
Combined_14.04.04.xls

Thanks in advance.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




ajliaks[_6_]

Saving a file with todays date on the end
 
hey!

Try something like this!

Function GetName(Dia As Date) As String
Dim AuxStr As String
AuxStr = Format(Dia, "dd-mmm-yyyy")
GetName = "Combined Automatic Update - " & AuxStr & ".xls"
End Function


Sub SaveUpdate(Route As String)

'make sure the path exists and its right!!!

Route = "C:\Documents and Settings\Administrator\Desktop\updat
automatic\"
Dim Name As String
Dim I As Integer
If Right(Route, 1) < "\" Then Route = Route & "\"
Name = GetName(Now())
If Dir(Route & Name) < "" Then
I = 1
Name = Left(Name, Len(Name) - 4)
While Dir(Route & Name & " Version (0" & I & ")" & ".xls") <
""
I = I + 1
Wend
Name = Name & " Version (0" & I & ")" & ".xls"
End If
ActiveWorkbook.SaveCopyAs Route & Name
End Sub

M

--
Message posted from http://www.ExcelForum.com


Tempy

Saving a file with todays date on the end
 
Thanks Bob, your suggestion works great.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

david mcritchie

Saving a file with todays date on the end
 
For your backup or daily file.

Would suggest that you use four digit year and put that first
then the month then the day of the month so that you can
find them quickly in a directory in alphabetical order.
http://www.mvps.org/dmcritchie/excel/backup.htm




slc[_9_]

Saving a file with todays date on the end
 
Bob,

Just want to say "Thanks" as I also benefitted from your solution.

SLC
:

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Saving a file with todays date on the end
 
Great, 2 for 1 <vbg

--

HTH

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

"slc " wrote in message
...
Bob,

Just want to say "Thanks" as I also benefitted from your solution.

SLC
:)


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:40 AM.

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