(Solved) – Difficulties formatting footers with VBA in Excel


i’m having head pulling out issues trying to format two footers in a template generated by executing a VBA Macro. As part of this progress I wish to have my footer text returned in a grey colour, in Times New Roman, size 12; center footer is a “Page &P of &N” type and right footer is a user-selected string variable, in this instance it is named as exdet(1). I had this working ok before needing to change the colour. I can now control my colour…but I get back an unwanted set of inverted commas. For example, the following snippet:

With shexam2.PageSetup
        .DifferentFirstPageHeaderFooter = True
        .RightFooter = "&K808080""&""Times New Roman""&12" & exdet(1)
        .CenterFooter = "&K808080""&""Times New Roman""&12" & "Page &P of &N"
End With

returns for the center footer:
“Page 2 of 9


for the right footer:


I’m sure this is obvious, but my head is sore from banging it on the keyboard!

Many thanks in advance


Leave a Reply

Your email address will not be published. Required fields are marked *