Delete footnotes in a Word document with VBA

There must be some easy way to delete all the footnotes in Word document.
The following code works if one knows that there are 44 footnotes are in a document, but there must be a better way.

Dim i as Integer
Do
      Selection.GoTo What:=wdGoToFootnote, Which:=wdGoToNext, Count:=1, Name:=""
      Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
      Selection.Delete Unit:=wdCharacter, Count:=1
      i = i + 1
      If i = 44 Then End
Loop
Thanks for any help possible.
JRA
JohnRobinAllenRetired professor of FrenchAsked:
Who is Participating?
 
Robert SchuttSoftware EngineerCommented:
Try this:
    Dim i As Integer
    For i = Application.ActiveDocument.Footnotes.Count To 1 Step -1
        Application.ActiveDocument.Footnotes(i).Delete
    Next

Open in new window

0
 
JohnRobinAllenRetired professor of FrenchAuthor Commented:
The solution works beautifully. Many thanks!
   --j.r.a.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.