Created
January 15, 2023 14:40
-
-
Save devnoname120/eabbdef685dc370087310794690b8047 to your computer and use it in GitHub Desktop.
PowerPoint — Force to reapply the master note to all the slides
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub RestoreNotesPages() | |
Dim oSld As Slide | |
Dim oShp As Shape | |
Dim lIdx As Long | |
On Error Resume Next | |
With ActivePresentation | |
For Each oSld In .Slides | |
With oSld.NotesPage.Shapes | |
' Delete the objects from the notes page in reverse order | |
For lIdx = .Count To 1 Step -1 | |
' Make a copy of any existing notes pane text | |
If .Item(lIdx).PlaceholderFormat.Type = ppPlaceholderBody Then | |
' IsNumeric() is there to avoid false positives on slide page number | |
If .Item(lIdx).TextFrame.HasText And Not IsNumeric(.Item(lIdx).TextFrame2.TextRange) Then | |
.Item(lIdx).TextFrame2.TextRange.Copy | |
.Item(lIdx).Delete ' Delete the text | |
End If | |
End If | |
.Item(lIdx).Delete ' Delete the placeholder | |
Next | |
DoEvents | |
' Recreate the placeholder objects on the notes page | |
.AddPlaceholder ppPlaceholderTitle | |
.AddPlaceholder(ppPlaceholderBody).TextFrame2.TextRange.Paste | |
.AddPlaceholder ppPlaceholderSlideNumber | |
End With | |
Next | |
End With | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment