Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-06-2015, 12:21 PM
GLENCOE GLENCOE is offline Get footnote reference Windows XP Get footnote reference Office 2007
Novice
Get footnote reference
 
Join Date: Oct 2011
Location: Montreal, QC, Canada
Posts: 4
GLENCOE is on a distinguished road
Default Get footnote reference

Question already posted here: http://www.vbaexpress.com/forum/show...note-reference



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/show...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!


Code:
Dim aFN as Footnote
Dim nRef As String
For Each aFN In ActiveDocument.Footnotes
        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

Basically, what I want to accomplish is:

Code:
Dim aFN as Footnote
Dim nRef As String
For Each aFN In ActiveDocument.Footnotes
        nRef = 'what do I need here to get the reference mark?
        MsgBox "Character/symbol used to call this footnote is " & nRef
Next aFN
Thanks for helping me...

Glencoe
Reply With Quote
  #2  
Old 04-07-2015, 04:08 AM
GLENCOE GLENCOE is offline Get footnote reference Windows XP Get footnote reference Office 2007
Novice
Get footnote reference
 
Join Date: Oct 2011
Location: Montreal, QC, Canada
Posts: 4
GLENCOE is on a distinguished road
Smile Found a trick

Based on initial macropod's idea from the other thread I referenced in my first post, I found a trick that works. Ok, it may not be ideal, but it does work, and that's all I am asking!

Code:
Dim aFN As Footnote
Dim nRef As String
    
For Each aFN In ActiveDocument.Footnotes
        With aFN
            With .Reference.Characters.First
                .Collapse
                .InsertCrossReference wdRefTypeFootnote, wdFootnoteNumberFormatted, aFN.Index
                nRef = .Characters.First.Fields(1).Result
                .Characters.Last.Fields(1).Delete
                MsgBox nRef
            End With
        End With
Next aFN
If anyone has a better and cleaner idea than inserting and deleting the reference next to the original one, I'd like to hear it, but it seems that this same request is not quite knew and has already hit many walls (I just found while googling similar key terms that many people have asked the same question over the past 10 years, without finding any real solution)...

Now, even though he hasn't participated to this thread yet, I'd like to thank macropod for leading me to a working solution! The "insert" method he offered in the other post was a clever way to bypass the issue...
Reply With Quote
Reply

Tags
footnote, reference

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Footnote help!!! kilian Word 3 03-27-2015 12:36 AM
Footnote is getting cut Tyiliyra Word 1 09-14-2014 11:19 AM
Get footnote reference Reference number and cross reference for equation numbers to match the thesis format wmac Word 1 05-14-2013 08:54 PM
Get footnote reference Problems with footnote Christiano Word 2 05-31-2011 08:55 PM
footnote problem Palinkasocsi Word 0 08-07-2010 01:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft