PDA

View Full Version : [SOLVED:] Button to remove all footnotes



RayKay
12-28-2018, 07:55 AM
Hi all (especially John, happy new year!)

Is there a way to use VBA to clear all footnotes, rather than go FILE > INSPECT DOCUMENT and the tick panel showing? Just a code to remove all footnotes?

Thank you, and for all your help in 2018. Magic :)

John Wilson
12-29-2018, 12:27 AM
You need to explain exactly what you mean by 'footnotes'.

Speaker Notes ?
Comments?
Something else?

RayKay
12-31-2018, 01:39 AM
Hi, sorry John, my fault. I meant to say 'notes' or also known as 'Speaker Notes'.

I've worked it out thanks, and here's the code for anyone reading this:


Sub RemoveSpeakerNotes()


Dim sld As Slide


For Each sld In ActivePresentation.Slides
sld.NotesPage.Shapes.Placeholders
(2).TextFrame.TextRange _
= ""
Next sld


End Sub

John Wilson
12-31-2018, 03:24 AM
Just a note then:

There are rare situations where PlaceHolders(2) is NOT the Notes Text. 99% of the time it will be but it can fail if eg the slide placeholder has been deleted and a footer added. Always check that the placeholder is the correct type (body)

RayKay
12-31-2018, 04:27 AM
Thank you :) Happy new year

John Wilson
12-31-2018, 07:21 AM
Sub kill_notes()
Dim osld As Slide
For Each osld In ActivePresentation.Slides
getNotes(osld.NotesPage).TextFrame.TextRange = ""
Next osld
End Sub


Function getNotes(npage As Object) As Shape
Dim L As Long
For L = 1 To npage.Shapes.Placeholders.Count
If npage.Shapes.Placeholders(L).PlaceholderFormat.Type = ppPlaceholderBody Then
Set getNotes = npage.Shapes.Placeholders(L)
Exit Function
End If
Next L
End Function