Need code to change font size in custom footer?

Barry Katcher

Well-known Member
Joined
Feb 25, 2002
Messages
4,053
I have the following macro which inserts the full path and file name in a footer:

Sub InsertPathInFooter
ActiveSheet.PageSetup.LeftFooter =
ActiveWorkbook.FullName
End Sub

What can I add to it to then change the font size from 12 to 9? I tried recording a macro for Page Setup/Custom Footer/Font icon, etc. It does change the font on the worksheet, but I don't see any line of code in the macro that does the change.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Thanks, lenze. I added the following excerpt from your code:

With ActiveSheet.PageSetup.LeftFooter = "&""Ariel,Bold""&7"
End With

The macro ran without an error message, but nothing changed, neither font not font size nor bold. What am I missing?
 
Upvote 0
Hi Barry:

Try this

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&""Arial,Bold""&7" & ActiveWorkbook.FullName
End With
End Sub

Note the spelling of ARIAL
 
Upvote 0
Thanks a mill, lenze. I just changed "bold" to "regular" and it works perfectly. I'll also add it to my "save before closing" macro and to my "print" macro, in case I save the file to a different folder. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,824
Members
449,050
Latest member
Bradel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top