Dr. Demento
Well-known Member
- Joined
- Nov 2, 2010
- Messages
- 618
- Office Version
- 2019
- 2016
- Platform
- Windows
There are instances where the font I prefer cannot be printed so I need to update the font thruout a workbook. I know how to do so with the worksheet cells but I'm a bit stuck on the PageSetup headers & footers. I'm hoping there's a looping procedure I can use; I just have not been able to find the appropriate syntax.
My goal is that if the header/footer is not empty, to use whatever text is already present (sometimes it's static (creation date) and sometimes it's dynamic (Page &P of &N)) and only change the font (I know what the final font is but I don't always know the original font and sometimes there are multiple fonts). Additionally, there are formats that I would like to preserve (bold, color, size).
Thoughts? Thanks y'all.
Here's what the Macro Recorder provided.
My goal is that if the header/footer is not empty, to use whatever text is already present (sometimes it's static (creation date) and sometimes it's dynamic (Page &P of &N)) and only change the font (I know what the final font is but I don't always know the original font and sometimes there are multiple fonts). Additionally, there are formats that I would like to preserve (bold, color, size).
Thoughts? Thanks y'all.
Here's what the Macro Recorder provided.
VBA Code:
Application.PrintCommunication = False
With sht.PageSetup
.LeftHeader = ""
.CenterHeader = _
"&""Consolas,Regular""&10File: &F || Sheet: &""Consolas,Bold""&KFF0000&A" & Chr(10) & "&""Consolas,Regular""&K000000Path: &K7030A0\\_Path\Path\Path\"
.RightHeader = ""
.LeftFooter = _
"&""Consolas,Regular""Author: ______" & Chr(10) & "Created: 07/01/2021 || 10:18"
.CenterFooter = "&""Consolas,Regular""Page &P of &N"
.RightFooter = _
"&""Consolas,Regular""Last Author: ______" & Chr(10) & "Last Modified: 07/01/2021 || 15:05"
End With
Application.PrintCommunication = True