Macro(MS Word 2002)Remove Blank Footnote

V

vglover1

Help. I have documents in which the footnotes were incorrectly
removed, by deleting the actual footnote at the bottom of the page
rather than the number in the main text. The numbers are left in the
main text of the document which link to an empty, deleted spot in the
footnotes. There are too many documents to individually open and
clear footnote numbers that link to a deleted spot in the footnotes.
I need help to write a macro (or vba) to check the footnote for text,
and IF no text found, then delete the footnote number and loop until
all footnotes are checked for text. Please help if you can.
 
D

Doug Robbins - Word MVP

The following code will delete the empty footnote references from a document

Dim fn As Footnote
For Each fn In ActiveDocument.Footnotes
If Trim(fn.Range.Text) = "" Then
fn.Reference.Delete
End If
Next

You could modify the code in the article "Find & ReplaceAll on a batch of
documents in the same folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

to incorporate the code given above so that you could process all of the
documents in a folder.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top