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
 

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

Similar Threads

Date Format 6
having an issue with date formats 9
date format 2
datatype conversion 1
Trouble with SaveAs .csv 4
Assigning Path 2
Date format error with CSV file 6
Strange Julian Date Phenomenon 9

Back
Top