Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-11-2022, 09:06 PM
BrianHoard BrianHoard is offline How can I expand the range of an endnote with multiple paragraphs in the text? Windows 10 How can I expand the range of an endnote with multiple paragraphs in the text? Office 2019
Advanced Beginner
How can I expand the range of an endnote with multiple paragraphs in the text?
 
Join Date: Jul 2022
Location: Haymarket, VA USA
Posts: 85
BrianHoard is on a distinguished road
Default How can I expand the range of an endnote with multiple paragraphs in the text?

I am working on my first VBA script which needs to copy the reference text of each endnote. I'm able to set a range for the endnote reference text fine except when the writer's have added multiple paragraphs. I am currently expanding my range to the end of the paragraph, however it only expands the end of the range to the first paragraph. Is it possible to expand the range to multiple paragraphs? Here's my code for getting the range now:
Code:
  rng_source.Expand Unit:=wdParagraph

Here's an example of a typical endnote. The # represents where the endnote superScript would be. Notice the writers put text (ABC) before the endnote number:
(ABC) #Some text paragraph1
Possible additional text paragraph2
paragraph3, etc.




(XYZ) #Next endnote. Could have only 1 or more paragraphs.
Reply With Quote
  #2  
Old 07-11-2022, 09:44 PM
Guessed's Avatar
Guessed Guessed is offline How can I expand the range of an endnote with multiple paragraphs in the text? Windows 10 How can I expand the range of an endnote with multiple paragraphs in the text? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
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

You can move the start or end of a range in a forward or backward direction
Code:
rng_Source.MoveEnd Unit:=wdParagraph, Count:=2
rng_Source.MoveEnd Unit:=wdParagraph, Count:=-2
rng_Source.MoveStart Unit:=wdCharacter, Count:=-10
rng_Source.MoveStart Unit:=wdWord, Count:=5
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 07-11-2022, 11:04 PM
macropod's Avatar
macropod macropod is offline How can I expand the range of an endnote with multiple paragraphs in the text? Windows 10 How can I expand the range of an endnote with multiple paragraphs in the text? Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You seem to be making this overly complicated:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim eNt As Endnote
With ActiveDocument
  For Each eNt In .Endnotes
    MsgBox "EndNote:" & vbCr & eNt.Index & vbCr & "Text:" & vbCr & eNt.Range.Text
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 07-12-2022, 09:49 PM
BrianHoard BrianHoard is offline How can I expand the range of an endnote with multiple paragraphs in the text? Windows 10 How can I expand the range of an endnote with multiple paragraphs in the text? Office 2019
Advanced Beginner
How can I expand the range of an endnote with multiple paragraphs in the text?
 
Join Date: Jul 2022
Location: Haymarket, VA USA
Posts: 85
BrianHoard is on a distinguished road
Default

Thanks for the help, Macropod. Your code helped get me on the right track.
Reply With Quote
Reply

Tags
endnote reference, range



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I expand the range of an endnote with multiple paragraphs in the text? How can I select all the text in a table cell when it contains multiple paragraphs? wrdy Word 4 05-18-2022 12:25 AM
Loop to Collapse Paragraphs within Range Not Working poetofpiano Word VBA 1 03-11-2018 06:29 PM
How can I expand the range of an endnote with multiple paragraphs in the text? Endnote and in-text citations in Word nato2015 Word 1 07-04-2015 03:35 PM
endnote and import reference from word to endnote uncung Word 0 06-18-2011 08:09 AM
How can I expand the range of an endnote with multiple paragraphs in the text? Cross-reference endnote text smed Word 3 01-14-2011 03:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:13 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