ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format dates in VB (https://www.excelbanter.com/excel-programming/289698-format-dates-vbulletin.html)

Mervyn Thomas

Format dates in VB
 
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



Jim Cone

Format dates in VB
 
Mervyn,

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

Regards,
Jim Cone
San Francisco, CA

"Mervyn Thomas" wrote in message
...
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




Hank Scorpio

Format dates in VB
 
On Fri, 30 Jan 2004 10:26:14 -0000, "Mervyn Thomas"
wrote:

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...

---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *

Mervyn Thomas

Format dates in VB
 
Thanks a million - I tried searching the useless help section for ages!

"Jim Cone" wrote in message
...
Mervyn,

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

Regards,
Jim Cone
San Francisco, CA

"Mervyn Thomas" wrote in message
...
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






Bob Phillips[_6_]

Format dates in VB
 
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)

"Mervyn Thomas" wrote in message
...
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






All times are GMT +1. The time now is 07:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com