Saving a file with todays date on the end

  • Thread starter Thread starter Tempy
  • Start date Start date
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
 
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)
 
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
 
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)
 
Back
Top