Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for Current Date in the Header

Status
Not open for further replies.

dh31

IS-IT--Management
Aug 30, 2006
1
US
I am looking for code that will add the current date (MM/DD/YY format)in the header section.
 
Hi there,

Not sure what application you're even talking about, but if it's Excel ...

Code:
Sheets("Sheet1").Pagesetup.centerheader = format(date, "mm/dd/yy")

HTH

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
And if it is Word, AND it is for the Primary header of Section 1....
Code:
 ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range _
   .InsertDateTime DateTimeFormat:="MM/dd/yy", _
    InsertAsField:=False
Of course if it is for a different header, then wdHeaderFooterPrimary would have to be changed. If it is for a different section, then Sections(1) would have to be changed.

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top