When I click on the date icon in Custom Header/Footer it currently inserts the date in the format mm/dd/yyyy which I think must be coming from the Regional Settings Short Date Format.
How do I insert the date in the format: July 31, 2001?
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Date Format in Header/Footer (2000 SR-1a)
Here is the procedure:
1- Open the workbook.
2- Press Alt+F11 – This should open the VB Editor.
3- The project explorer window should be on the left side of the screen (It should say Project – VBAProject in the title bar). In the project tree, find the line that says VBAProject with your file name in parenthesis. If there is a plus sign to the left of this line, click on the plus sign which should expand the project.
4- Find the line under your workbook project that says “Microsoft Excel Objects.” If it has a plus sign to its left, click on the plus sign to expand the objects.
5- Under “Microsoft Excel Objects” double click on ThisWorkbook. This should open a code edit window on the right side of the screen.
6- At the top of the code edit window should be two combo boxes. The left combo box should have (General) in it. Click on the arrow and select Workbook from the list. This should show an empty procedure for the Workbook_Open event in the lower part of the screen.
7- Click on the arrow in the right combo box to display a list of event routines. Scroll up if necessary to find BeforePrint and select it. You should now see an empty BeforePrint routine that look like this:
Private Sub Workbook_BeforePrint(Cancel As Boolean) End Sub
Put the code between those two lines.
This could easily be made to apply to all new workbooks, or all new workbooks created from a specific template. Just create an empty workbook and put the code into the before print event routine as shown. If you want it to apply to all new workbooks, then do a File SaveAs and save the workbook as a template named Book.xlt in the XLStart directory. If you want it to apply only to workbooks created from a specific template, then do the File SaveAs and save it as a template with a name you choose and put it in your template directory.
I do not know of an easy way to have it apply to existing workbooks.
You could easily put that line of code in a general macro and assign that macro to a button. This would put the date into the Header/Footer when the button was pressed, but it would not be automatically updated when the sheet was printed.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications