I have a large document with several hundred footnotes. I'm looking
for a code to replace the footnote reference with the actual footnote
text. Any ideas on where to start?
--
Fredrik E. Nilsen
The following should get you started:
Sub ReplaceFootnotesWithTheirText()
Dim nCounter As Long
Dim fn As Word.Footnote
Dim rngFN As Word.Range
For nCounter = ActiveDocument.Footnotes.Count To 1 Step -1
'Get a reference to our footnote
Set fn = ActiveDocument.Footnotes(nCounter)
'Work out where to copy the text
Set rngFN = fn.Reference
rngFN.Collapse wdCollapseEnd
'Copy the text of the footnote into the body of the document
rngFN.FormattedText = fn.Range.FormattedText
'Delete the footnote
fn.Delete
Next nCounter
End Sub
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
"Fredrik E. Nilsen" <fenilse...@chello.no> wrote in message
news:7tj2e3lfjk98tkm14...@4ax.com...
I'm glad it worked. Thanks for letting us know.
Shauna
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
"Fredrik" <feni...@gmail.com> wrote in message
news:1189237820.0...@o80g2000hse.googlegroups.com...
Thanks so much!
> On Friday, September 07, 2007 9:22 AM Fredrik E. Nilsen wrote:
> Hello,
>
> I have a large document with several hundred footnotes. I'm looking
> for a code to replace the footnote reference with the actual footnote
> text. Any ideas on where to start?
>
> --
> Fredrik E. Nilsen
>> On Friday, September 07, 2007 9:54 AM Shauna Kelly wrote:
>> Hi Fredrik
>>
>> The following should get you started:
>>
>> Sub ReplaceFootnotesWithTheirText()
>>
>> Dim nCounter As Long
>> Dim fn As Word.Footnote
>> Dim rngFN As Word.Range
>>
>> For nCounter = ActiveDocument.Footnotes.Count To 1 Step -1
>> 'Get a reference to our footnote
>> Set fn = ActiveDocument.Footnotes(nCounter)
>>
>> 'Work out where to copy the text
>> Set rngFN = fn.Reference
>> rngFN.Collapse wdCollapseEnd
>>
>> 'Copy the text of the footnote into the body of the document
>> rngFN.FormattedText = fn.Range.FormattedText
>>
>> 'Delete the footnote
>> fn.Delete
>>
>> Next nCounter
>>
>> End Sub
>>
>>
>> Hope this helps.
>>
>> Shauna Kelly. Microsoft MVP.
>> http://www.shaunakelly.com/word
>>
>>
>> "Fredrik E. Nilsen" <fenilse...@chello.no> wrote in message
>> news:7tj2e3lfjk98tkm14...@4ax.com...
>>> On Saturday, September 08, 2007 3:50 AM Fredrik wrote:
>>> Not only did it get me started, it worked like a charm right out of
>>> the box. Thanks a lot!
>>>> On Saturday, September 08, 2007 8:37 AM Shauna Kelly wrote:
>>>> Hi Fredrik
>>>>
>>>> I am glad it worked. Thanks for letting us know.
>>>>
>>>> Shauna
>>>>