TechTalkz.com Home

Go Back   MS Office Help & Free Technical Support > MS Word Help
Home Register Forum Rules FAQ User Blogs Gallery

VBA Macro for Footnotes

MS Word Help


Reply
 
LinkBack Thread Tools Display Modes
Old 07-17-2009, 09:50 PM   #1
bruno
Guest
 
Posts: n/a
Default VBA Macro for Footnotes


Hi,

Re. "VBA Macro for Footnotes" - convert footnote numbers to pure text and
add the footnotes as a list at the end of the document, without any other
references than the numbers - in Word 2003 SP3.

Similar matter was dealt with in recent conversation "VBA Macro For
FootNotes" (5/25/2009) - where the list of footnotes was to be placed in a
new document -, and i also found an older conversation "Convert footnotes to
ordinary text" (sept. 2007) where the footnote text was to be put directly in
the body text.

By combining the solutions found there I think it should be no problem to
get the solution to my requirement, but it is not as simple as that, at least
not for someone like me: my skills go scarcely beyond using the macro
recorder.

Below i add my macro which I combined of the codes suggested in above
mentioned conversations. It stops at the first appearence of
rngfoot.Range.InsertParagraphAfter

Could someone please tell me what is wrong ?

sub
Dim docfoot As Footnotes
Dim i As Long
Dim rngfoot As Range
Dim fn As Word.Footnote
Dim rngFN As Word.Range

If ActiveDocument.Footnotes.Count > 0 Then
Set docfoot = ActiveDocument.Footnotes
Else
MsgBox "There are no footnotes in this document.", _
vbExclamation, "Exit"
Exit Sub
End If

Set rngfoot = ActiveDocument.Sections.Last
rngfoot.Range.InsertParagraphAfter
rngfoot.Range.InsertParagraphAfter

With docfoot
For i = 1 To .Count
rngfoot.Range.InsertAfter .Item(i).Range.Text
rngfoot.Range.InsertParagraphAfter

Set fn = ActiveDocument.Footnotes(i)

Set rngFN = fn.Reference
rngFN.Collapse wdCollapseEnd

rngFN.Range.InsertAfter "[ & i & ]"
fn.Delete

Next
End With
End Sub

It cost me a lot of time to come so far, was it all in vain?
bruno

Advertisement

  Reply With Quote
Old 07-17-2009, 11:50 PM   #2
macropod
Guest
 
Posts: n/a
Default Re: VBA Macro for Footnotes

Hi bruno,

It would help if you said what it is you're trying to do ...

--
Cheers
macropod
[Microsoft MVP - Word]


"bruno" <bruno.beeh@hotmail.com> wrote in message news:A108C2EE-1C73-4C9B-83FB-6D572B2A857D@microsoft.com...
> Hi,
>
> Re. "VBA Macro for Footnotes" - convert footnote numbers to pure text and
> add the footnotes as a list at the end of the document, without any other
> references than the numbers - in Word 2003 SP3.
>
> Similar matter was dealt with in recent conversation "VBA Macro For
> FootNotes" (5/25/2009) - where the list of footnotes was to be placed in a
> new document -, and i also found an older conversation "Convert footnotes to
> ordinary text" (sept. 2007) where the footnote text was to be put directly in
> the body text.
>
> By combining the solutions found there I think it should be no problem to
> get the solution to my requirement, but it is not as simple as that, at least
> not for someone like me: my skills go scarcely beyond using the macro
> recorder.
>
> Below i add my macro which I combined of the codes suggested in above
> mentioned conversations. It stops at the first appearence of
> rngfoot.Range.InsertParagraphAfter
>
> Could someone please tell me what is wrong ?
>
> sub
> Dim docfoot As Footnotes
> Dim i As Long
> Dim rngfoot As Range
> Dim fn As Word.Footnote
> Dim rngFN As Word.Range
>
> If ActiveDocument.Footnotes.Count > 0 Then
> Set docfoot = ActiveDocument.Footnotes
> Else
> MsgBox "There are no footnotes in this document.", _
> vbExclamation, "Exit"
> Exit Sub
> End If
>
> Set rngfoot = ActiveDocument.Sections.Last
> rngfoot.Range.InsertParagraphAfter
> rngfoot.Range.InsertParagraphAfter
>
> With docfoot
> For i = 1 To .Count
> rngfoot.Range.InsertAfter .Item(i).Range.Text
> rngfoot.Range.InsertParagraphAfter
>
> Set fn = ActiveDocument.Footnotes(i)
>
> Set rngFN = fn.Reference
> rngFN.Collapse wdCollapseEnd
>
> rngFN.Range.InsertAfter "[ & i & ]"
> fn.Delete
>
> Next
> End With
> End Sub
>
> It cost me a lot of time to come so far, was it all in vain?
> bruno

  Reply With Quote
Old 07-18-2009, 11:50 AM   #3
bruno
Guest
 
Posts: n/a
Default Re: VBA Macro for Footnotes

Advertisement
What i am trying to do ? ... Quite often I need to combine two long Word
documents (with many footnotes) side by side in two columns of an Excel table
(to allow paragraph alignment) - keeping essential text formatting like bold
and italic, the para numbers, the footnote numbers in the text and the
footnotes listed at the end of the table, they can have same font size and
colour as body text.

To do this I convert the text to table in Word and then copy and paste the
table to Excel. When I have my table completed in Excel i copy it back to a
new Word document for further processing (formatting, save, print).

The footnotes cause two problems:
1. In Excel the cells containing footnote numbers appear as links in small
fontsize and colour. To change this i deactivate hyperlinks and adapt the
font size.
2. And when I copy and paste the table back to Word the footnotes appear
again in another colour and underlined, and again I have to correct this.

I think these problems should be avoided by executing the following task in
the original Word documents:
-- break the links between footnote numbers in the text and the footnotes
and make appear both as ordinary text, with footnotes listed at the end of
the document (thus not as "endnotes"). The links are not required for my
purposes.

It is this task i am trying to automise with my macro. Can you tell me how
to make it work ?

bruno


Advertisement

  Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help >


New To Site? Need Help?

All times are GMT. The time now is 04:37 PM.


vBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional