From: Harry-Wishes on 8 Oct 2009 11:33 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
From: DaveLett on 8 Oct 2009 12:15 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 "Harry-Wishes" wrote: > 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
From: Harry-Wishes on 9 Oct 2009 11:05 Fabulous! Excellent! Works like a champ. Thanks Harry_Wishes "DaveLett" wrote: > 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 > > "Harry-Wishes" wrote: > > > 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
|
Pages: 1 Prev: Option Buttons created with Forms Next: Best practice for SendKeys or equivalent |