Excel footer issue #
I am creating a C # Windows Application to create an Excel 2003 worksheet. There is a requirement to add to the footer: Page 1 of 4.
I currently have this, so it puts "Page: & [Page] of & [Pages]" in the excel sheet footer.
When I open the created document and view the footer, I see "Page: Page] of pages]"
I can click on the text, it highlights it and shows what it should and it works correctly after that.
Is there a way to make it work from the start?
source to share
In Excel 2007, if you enter this as a footer:
Page &[Page] of &[Pages]
Then go to the immediate VBA edit window and enter the following:
print ActiveSheet.PageSetup.CenterFooter
result:
Page &P of &N
In other words, the value entered in the code is different from the value entered in the user interface.
Given that Microsoft treats backward compatibility like some holy book, I strongly suspect you are seeing the same thing in Excel 2003 - try changing your code to set Page & P of & N instead.
source to share