Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-19-2023, 03:55 PM
Guessed's Avatar
Guessed Guessed is online now Loop through Footnote Reference Marks Windows 10 Loop through Footnote Reference Marks Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,164
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Your code is flawed, it repeats the inner loop on exactly the same thing multiple times. The Footnote References only exist in the Main Story so there is no point in looping through every story range.

You can't actually put footnote references in text boxes, headers, footers or footnote areas because Word doesn't allow it (although you can paste one in and it resets to 1) - so looping through the various ranges to find footnotes serves no purpose (and in fact errors in the below code).

Looking at the code issue, when you want to run a loop across each StoryRange you need to refer to that story range instead of the parent document (see the bold word in this code and compare with your code)
Code:
Sub FootnoteMark()
  Dim oStory As Range, FtNt As Footnote
  For Each oStory In ActiveDocument.StoryRanges
    For Each FtNt In oStory.Footnotes
       'do stuff
    Next
  Next oStory
End Sub
However, this inner loop will fail because Footnotes don't go into different story ranges - just the main body of the document. This means there is no point repeating the inner loop the same number of times as there are story ranges.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia

Last edited by Guessed; 09-19-2023 at 08:10 PM. Reason: added more info
Reply With Quote
 

Tags
ref mark ftnt sec



Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop through Footnote Reference Marks Removing line break and indentation between footnote number and footnote text in Word jaanross Word 5 02-06-2020 12:04 AM
Loop through Footnote Reference Marks Footnote reference numbers precede by superscript '(' and follow w/ superscript ')' Swarup Word 4 07-18-2019 05:51 PM
Loop through Footnote Reference 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 Reference Marks How to keep the footnote(endnote) reference numbers when pasting text between two documents? gn4619 Word 4 10-22-2015 08:01 AM
Get footnote reference GLENCOE Word VBA 1 04-07-2015 04:08 AM

Other Forums: Access Forums

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


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