How can Font and Other Formatting be Updated in Excel and Word Macros?
Who is this article for?
All Ideagen Quality Management Users with access to documents.Ideagen Quality Management site access is 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 can font and other formatting like space be updated in Excel and Word macros?
2. Answer
There are different types of VBA code available to update the Excel and Word macros. While we typically provide customers with a basic Excel or Word template when they ask, we can also provide certain formatting within limitations.
Adding a uniform second line:
& Chr(13) _
Example of changing font type and font size:
(This macro changes the header to Times new roman 18pt and the footer to times new roman 11pt.)
wks.PageSetup.LeftHeader = "&""Times New Roman""&18" & Chr(32) & DocProperty("##TITLE##")
wks.PageSetup.LeftFooter = "&""Times New Roman""&11" & Chr(13)
Adding spaces to a line of code with multiple variables:
wks.PageSetup.LeftFooter = "&L" & DocProperty("##ID##") & Space(2) & DocProperty("##TITLE##") & Chr(13) _
& "&L" & "Status: " & DocProperty("##STATUS##") & Space(2) & "Issue Date: " & DocProperty("##DATE_PUBLISHED##") & Space(2) & "Revision: " & DocProperty("##REVISION##")
3. Further Reading
This section will provide important links to further troubleshooting and resources.
- External Article - Microsoft article on formatting VBA code.