Saving a file with todays date on the end

T

Tempy

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!
 
B

Bob Phillips

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)
 
A

ajliaks

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top