M
Mongoose
Help. I'm really struggling with this but I can't seem to figure out
where it's going wrong. I'm still a beginner. I'm trying to write a
macro that runs through my document selecting text based on certain
conditions and then moving it to a footnote from that location. In
this case it is finding a word or phrase and moving the translation of
that word/phrase that follows between the |pipes| to the a footnote of
the word/phrase that has preceded it.
This is an example of the text I'm running it on everything in the
pipes (all formatted Font.Color = wdColorDarkBlue) is actually making
a footnote. But somewhere in the mix the footnotes are getting lost.
EXAMPLE TEXT
Human rights |amalungelo omutu wonke| include civil and political
rights, such as the right to life and liberty |inkululeko|.
MY MACRO
Sub Convert_to_footnote()
'
' Convert_to_footnote Macro
'
'
Dim oRange As Range
Dim fn As Footnote
Set oRange = ActiveDocument.Range
With oRange.Find
..ClearFormatting
..Forward = True
..Format = True
..Wrap = wdFindStop
..Font.Superscript = False
..Font.Color = wdColorDarkBlue
..Text = "|*|"
..MatchWildcards = True
..MatchDiacritics = True
..Execute
While .Found
Set fn = ActiveDocument.Footnotes.Add(oRange)
oRange.Move wdWord, 1
..Execute
Wend
End With
MsgBox ActiveDocument.Footnotes.Count
End Sub
where it's going wrong. I'm still a beginner. I'm trying to write a
macro that runs through my document selecting text based on certain
conditions and then moving it to a footnote from that location. In
this case it is finding a word or phrase and moving the translation of
that word/phrase that follows between the |pipes| to the a footnote of
the word/phrase that has preceded it.
This is an example of the text I'm running it on everything in the
pipes (all formatted Font.Color = wdColorDarkBlue) is actually making
a footnote. But somewhere in the mix the footnotes are getting lost.
EXAMPLE TEXT
Human rights |amalungelo omutu wonke| include civil and political
rights, such as the right to life and liberty |inkululeko|.
MY MACRO
Sub Convert_to_footnote()
'
' Convert_to_footnote Macro
'
'
Dim oRange As Range
Dim fn As Footnote
Set oRange = ActiveDocument.Range
With oRange.Find
..ClearFormatting
..Forward = True
..Format = True
..Wrap = wdFindStop
..Font.Superscript = False
..Font.Color = wdColorDarkBlue
..Text = "|*|"
..MatchWildcards = True
..MatchDiacritics = True
..Execute
While .Found
Set fn = ActiveDocument.Footnotes.Add(oRange)
oRange.Move wdWord, 1
..Execute
Wend
End With
MsgBox ActiveDocument.Footnotes.Count
End Sub