Word: Convert smart endnotes into dumb ones

Soldato
Joined
28 Dec 2003
Posts
3,768
Location
Aberwristwatch
I need to do this in Word 2003 so that when I paste the endnotes into a separate document, the numbers don't all turn into '1'. I've found this macro online but it's failing to run. "Compile error: Invalid Outside Procedure"

Any ideas?

Code:
' Macro created 29/09/99 by Doug Robbins to replace footnotes with textnotes
at end of document

' to replace the footnote reference in the body of the document with a
superscript number.

'

Dim afnote As Endnote

For Each afnote In ActiveDocument.footnotes

ActiveDocument.Range.InsertAfter vbCr & afnote.Index & vbTab &
afnote.Range

afnote.Reference.InsertBefore "a" & afnote.Index & "a"

Next afnote

For Each afnote In ActiveDocument.Footnotes

afnote.Reference.Delete

Next afnote

Selection.Find.ClearFormatting

Selection.Find.Replacement.ClearFormatting

With Selection.Find.Replacement.Font

.Superscript = True

End With

With Selection.Find

.Text = "(a)([0-9]{1,})(a)"

.Replacement.Text = "\2"

.Forward = True

.Wrap = wdFindContinue

.Format = True

.MatchWildcards = True

End With

Selection.Find.Execute Replace:=wdReplaceAll
 
Last edited:
No, I don't think it was. Have done so now and getting the following:

Run-time error '13':
Type mismatch

On clicking OK, it takes me back into Visual Basic Editor and highlights the first line in yellow

"For Each afnote In ActiveDocument.Footnotes"
 
Many thanks for that Simon. Much appreciated. It's failing on the 18th line:

'rng.PasteAndFormat (wdFormatOriginalFormatting)'
 
Run-time error '4198': Command failed

I've tried it on a document with only two endnotes and it worked fine. The original document has 747
 
Back
Top Bottom