Format Dates

  • Thread starter Thread starter Mat
  • Start date Start date
M

Mat

Hi
I want to use VBA to rename some files with a date. Eg
for 30 Jan 2005 one file is renamed to "EN300105.txt" (eg
ddmmyy.txt)
I have used the following - which works, but actually
renames the file "EN3012005.txt" :
(eg it shortens the ddmmyy format - removes the 0 from
month, etc)
(NB- I know the code below refers to a Word VBA action,
but I will soon modify it for an Access one!)

strDay = Format(Day(Now), dd)
strMonth = Format(Month(Now), mm)
strYear = Format(Year(Now), yy)

ActiveDocument.SaveAs FileName:="c:\temp\EN" & strDay &
strMonth & strYear & ".txt",

How can this be changed such that it is
renamed "EN301205.txt"

Thanks
Mat
 
Back
Top