Tech Support banner

Status
Not open for further replies.
1 - 3 of 3 Posts

·
Registered
Joined
·
2 Posts
Discussion Starter #1
Hello,
I need a macro that converts footnotes to inline text. I have found two VB codes for that. Both don't work on MS word 2003 or 2007.
Here is the first macro:

Sub ConvertFootNotesToText()

Dim afootnote As Footnote

ActiveDocument.Range.InsertParagraphAfter
Selection.GoTo What:=wdGoToLine, Which:=wdGoToLast
Selection.GoTo What:=wdGoToBookmark, Name:="\Para"
Selection.Style = wdStyleNormal
ActiveDocument.GoTo What:=wdGoToLine, Which:=wdGoToFirst
For Each afootnote In ActiveDocument.Footnotes
Selection.GoTo What:=wdGoToFootnote, Count:=afootnote.Index
Selection.GoTo What:=wdGoToBookmark, Name:="\HeadingLevel"
Selection.MoveEnd Unit:=wdCharacter, Count:=-1
Selection.Collapse Direction:=wdCollapseEnd
Selection.Range.InsertAfter _
vbCr & "x" & afootnote.Index & "x " & afootnote.Range
Selection.GoTo What:=wdGoToLine, Which:=wdGoToNext
Selection.GoTo What:=wdGoToBookmark, Name:="\Para"
Selection.Style = wdStyleNormal
afootnote.Reference.InsertBefore "x" & afootnote.Index & "x"
Next afootnote

For Each afootnote In ActiveDocument.Footnotes
afootnote.Reference.Delete
Next afootnote

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

With Selection.Find.Replacement.Font
.Superscript = True
End With

With Selection.Find
.Text = "(x)([0-9]{1,})(x)"
.Replacement.Text = "\2"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = True
End With

Selection.Find.Execute Replace:=wdReplaceAll

ActiveDocument.GoTo What:=wdGoToLine, Which:=wdGoToFirst

End Sub

I get an error that says "The Find What text contains a Pattern Match expression which is not valid."
Debugger highlits the "Selection.Find.Execute Replace:=wdReplaceAll" line.
The same macro worked for some people. I tried it on two different machines, but to no avail. So, could anyone please help me with this?
 

·
Moderator , - Microsoft Support, Microsof
Joined
·
2,527 Posts
Re: Macro for converting footnotes to text

Hi repheon,

Without analysing the code (which look horrible), I suspect the problem may be to do with your system's Regional Settings. Try changing:
"(x)([0-9]{1,})(x)"
to:
"(x)([0-9]{1;})(x)"
 
1 - 3 of 3 Posts
Status
Not open for further replies.
Top