Extracting Footnotes and Endnotes

H

Harry-Wishes

Hello,

I am trying to write a script that will locate footnotes (or endnotes) in a
Word document and extract their contents into a new document. So far I have
been unlucky as it seems to me that the only way I can access an item is by
its index number, not its value (similar to the fields object). Is there some
way I can extract the text from an endnote or footnote?

Thanks

Harry_Wishes
 
D

DaveLett

Hi,
I think you can use something like the following:

Dim lCount As Long
Dim sEnd As String
Dim oDoc As Document

sEnd = "Endnotes" & vbCrLf
For lCount = 1 To ActiveDocument.Endnotes.Count
sEnd = sEnd & lCount & vbTab &
ActiveDocument.Endnotes(lCount).Range.Text & vbCrLf
Next lCount

sEnd = sEnd & "Footnotes" & vbCrLf
For lCount = 1 To ActiveDocument.Footnotes.Count
sEnd = sEnd & lCount & vbTab &
ActiveDocument.Footnotes(lCount).Range.Text & vbCrLf
Next lCount

Set oDoc = Documents.Add
oDoc.Range.Text = sEnd


HTH,
Dave
 

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