glencoe
04-06-2015, 05:39 AM
Hi everyone,
I am struggling to find a "simple information" on a footnote.
I need to get the reference character that is used for a given footnote. Say a Word doc has many footnotes/endnotes, I already have a macro that plays in them, but for every note, the macro has to display the original reference (in a msgbox for now), so say 1, 2, 3, 4, or a, b, c, or whatever symbol is used to call the footnote.
I found this thread http://www.vbaexpress.com/forum/showthread.php?31231-Activedocument-Footnotes-Reference-Text which gives interesting information, but I couldn't extract exactly what I need.
Using the code given by macropod in this thread, I found that this code would copy the reference mark next to the original one, and then nRef would give me the symbol that was used... But I don't actually want/need to copy the reference, I just want to know what it is! aFN.Index won't give me this information... and I can't find an equivalent "GetCrossReference" function that seems to work (not sure how to play with GetCrossReferenceItems, if that's the one)...
Please advise!
For Each aFN In ActiveDocument.Footnotes
Dim nRef As String
With aFN
With .Reference.Characters.First
.Collapse
.InsertCrossReference wdRefTypeFootnote, wdFootnoteNumberFormatted, aFN.Index
nRef = .Characters.First.Fields(1).Result 'this does give me the information I need, but not without using the line above
MsgBox nRef
End With
End With
Next aFN
Thanks for helping me...
Glencoe
I am struggling to find a "simple information" on a footnote.
I need to get the reference character that is used for a given footnote. Say a Word doc has many footnotes/endnotes, I already have a macro that plays in them, but for every note, the macro has to display the original reference (in a msgbox for now), so say 1, 2, 3, 4, or a, b, c, or whatever symbol is used to call the footnote.
I found this thread http://www.vbaexpress.com/forum/showthread.php?31231-Activedocument-Footnotes-Reference-Text which gives interesting information, but I couldn't extract exactly what I need.
Using the code given by macropod in this thread, I found that this code would copy the reference mark next to the original one, and then nRef would give me the symbol that was used... But I don't actually want/need to copy the reference, I just want to know what it is! aFN.Index won't give me this information... and I can't find an equivalent "GetCrossReference" function that seems to work (not sure how to play with GetCrossReferenceItems, if that's the one)...
Please advise!
For Each aFN In ActiveDocument.Footnotes
Dim nRef As String
With aFN
With .Reference.Characters.First
.Collapse
.InsertCrossReference wdRefTypeFootnote, wdFootnoteNumberFormatted, aFN.Index
nRef = .Characters.First.Fields(1).Result 'this does give me the information I need, but not without using the line above
MsgBox nRef
End With
End With
Next aFN
Thanks for helping me...
Glencoe