Format dates in VB

  • Thread starter Thread starter Mervyn Thomas
  • Start date Start date
M

Mervyn Thomas

How would I add a format to the current date in this bit of code. I want
dd/mm/yyyy:

ActiveSheet.PageSetup.CenterFooter = Date

Mervyn
 
Mervyn,

Try this...
ActiveSheet.PageSetup.CenterFooter = Format$(Date, "dd/mm/yyyy")

Regards,
Jim Cone
San Francisco, CA
 
How would I add a format to the current date in this bit of code. I want
dd/mm/yyyy:

ActiveSheet.PageSetup.CenterFooter = Date

If your copy of Windows is set up the appropriate way, all you need do
is assign the string "&D" to the CenterFooter property.

If you want the footer to appear that way regardless of the Windows
set up, you may be better off assigning it as a string:

ActiveSheet.PageSetup.CenterFooter= Format(date(),"dd/mm/yyyy")

Just remember that that IS a string, and that you'd need to refresh it
each time you wanted to print. But then I imagine that you have this
code in the Workbook_BeforePrint event anyway...
 
Mervyn,

Always best to format the dates in a neutral form

ActiveSheet.PageSetup.CenterFooter = format(Date, "dd mmm yyyy")

--

HTH

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