Microsoft Office Forums Loop through Footnote Refernece Marks

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2019, 10:07 AM
Ramses505 Ramses505 is offline Loop through Footnote Refernece Marks Windows 7 64bit Loop through Footnote Refernece Marks Office 2010
Novice
Loop through Footnote Refernece Marks
 
Join Date: May 2019
Posts: 1
Ramses505 is on a distinguished road
Default Loop through Footnote Refernece Marks

I have some code that loops through the actual Footnotes that looks like this;
Code:
Sub Test_Format_Footnote()
Dim f As Footnote

For Each f In ActiveDocument.Footnotes
  With f.Range.Characters(1)
    If .Text = vbTab Or .Text = " " Then 'Use any other sensible detection logic here
      .Text = vbTab
    Else
      .InsertBefore "Look Here !"
    End If
  End With
Next
End Sub

How do I loop through the Footnote Reference Marks; the numbers in the text linking to the actual footnote ?




I would like to change the format of them on several ways - I would also like to know how to just loop through them for future reference.


Thanks
Reply With Quote
  #2  
Old 05-11-2019, 04:11 PM
macropod's Avatar
macropod macropod is offline Loop through Footnote Refernece Marks Windows 7 64bit Loop through Footnote Refernece Marks Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,533
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

If you want to change the format of the footnote reference, modify the Footnote Reference Style. That way, you don't need any code to loop through them.

That said, if you have some other reason for looping through them, you might use code like:
Code:
Dim FtNt As Footnote
For Each FtNt In ActiveDocument.Footnotes
  With FtNt.Reference
    'Do stuff
  End With
Next
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 05-11-2019, 05:53 PM
eduzs eduzs is offline Loop through Footnote Refernece Marks Windows 10 Loop through Footnote Refernece Marks Office 2010 32bit
Competent Performer
 
Join Date: May 2017
Posts: 157
eduzs is on a distinguished road
Default

I don't know if you can change each footnote individually.
But, to format all footnotes at once references and text you can try (test, backup before) this:
(This code I use in one of my macros, so you need to adapt it to do what you need, if it's suitable for your needs)

Code:
Set doc = activedocument

doc.Footnotes(1).Range.text = doc.Footnotes(1).Range.text & "Hi" ' Add some text to the first footnote of the document
  
doc.Styles(wdStyleFootnoteReference).Font.Color = wdColorWhite ' Format the reference numbers

With doc.Styles(wdStyleFootnoteText) ' Format the main text itself
    .Font.Size = 16
    .ParagraphFormat.Alignment = wdAlignParagraphCenter
End With

doc.StoryRanges(wdFootnoteSeparatorStory).Delete ' The separator line (remove)
__________________
Backup your original file before doing any modification, test in a throwaway copy of your file.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop through Footnote Refernece Marks Space between footnote number and footnote text Sabya Word 6 07-29-2018 02:30 PM
Footnote spacing after last footnote Raffiki Word 3 04-22-2017 02:18 PM
Loop through Footnote Refernece Marks How do I fix this unknown problem? Right-angle marks in corners - crop marks Quillo1234 Word 2 07-20-2016 02:24 AM
Loop through Footnote Refernece Marks Problem with footnote numbering -- Two different footnote levels mdhg Word 7 05-19-2016 06:33 AM
Loop through Footnote Refernece Marks No space between footnote number and footnote cgp1689 Word 6 10-13-2015 08:24 AM


All times are GMT -7. The time now is 05:09 AM.


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