How are the Date and Time Formats for Date Published Variable Updated in Word and Excel Macros?
Who is this article for?
All Ideagen Quality Management Users with access to documents.Ideagen Quality Management site accessis needed.
To make answering this question easier, this article is split into three sections so that you can either walk through the steps in sequence or you can jump to the section relevant to what you are looking for:
1. Question
How are date and time formats updated for the date published variable in Word and Excel macros?
2. Answer
We get requests to edit the date published variable so only time stamp is remove or the date shows in a certain format like European date formats.
For Word documents, this would need to be done in Quick Parts.
- Open the template in Word.
- Go to Quick Parts>Doc Property>Field Codes. Example of how to format to use:
DOCPROPERTY ##DATE_PUBLISHED##\@ "dd/MM/yy"
- The format can be adjusted by changing the dd/MM/yyyy part.
- Confirm the changes by using Alt+F9 to toggle the field codes to show the new date published variable. (If you have clicked inside the header or footer Alt+F9 will not work.)
For Excel documents, the date would be edited directly in the macro.
- Open the template in Excel and go to View>Macros (Alt+F8).
- Select This Workbook or the name of the template from the Macros in: drop-down.
- Use the following format to edit the existing date published variable. Format(DocProperty("##DATE_PUBLISHED##"), "dd/MM/yyyy")
Example line:
sFooter = "&C" & "Issue Date: " & Format(DocProperty("##DATE_PUBLISHED##"), "MM/dd/yyyy") _
3. Further Reading
This section will provide important links to further troubleshooting and resources.
- External Article - Microsoft article on updating date and time in variable.