I am trying to write some VBA to hide page numbers on the notes page in PowerPoint. I can do this for the slides using the code below, but cant find a solution for the notes/handouts page.
Sub hideNotesPageNumbers()
Dim sld As Slide
For Each sld In ActivePresentation.Slides
sld.HeadersFooters.SlideNumber.Visible = False
Next sld
End Sub
So Possibly, something like
Dim sld As NotesPage
For Each sld In ActivePresentation.NotesPage
sld.HeadersFooters.NotesPageNumber.Visible = False
Next sld
In powerpoint you can do this via Insert -> Header and Footer -> Note and Handouts -> page numbers
CodePudding user response:
It's a bug/design flaw. While this code should work:
Sub HideNotesPageNumbers()
Dim oSlide As Slide
For Each oSlide In ActivePresentation.Slides
oSlide.NotesPage.HeadersFooters.SlideNumber.Visible = msoFalse
Next oSlide
End Sub
it will only give you an error because the HeaderFooters property has been left out of the object model for notes pages. It appears MS is aware of this, because on the support page for .NotesPage, they include this disclaimer:
"The following properties and methods will fail if applied to a SlideRange object that represents a notes page: Copy method, Cut method, Delete method, Duplicate method, HeadersFooters property, Hyperlinks property, Layout property, PrintSteps property, SlideShowTransition property."
If it's any help, you can run this code to hide the page numbers on new notes pages. Existing notes pages will still show the number.
Sub HideNotesMasterPageNumbers()
ActivePresentation.NotesMaster.HeadersFooters.SlideNumber.Visible = False
End Sub