Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-29-2015, 10:49 PM
gmayor's Avatar
gmayor gmayor is offline Get paragraph number from macro Windows 7 64bit Get paragraph number from macro Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You are probably going to have to do a bit of lateral thinking to grab this number from the autonumbered field in your document. The following macro should work for the paragraph at the cursor
Code:
Dim ofld As Field
Dim orng As Range
    Set ofld = Selection.Paragraphs(1).Range.Fields(1)
        ofld.Unlink
        Set orng = Selection.Paragraphs(1).Range.Previous
        orng.Collapse 0
        orng.MoveEndUntil Chr(9)
        orng.Select
        MsgBox orng.Text
        ActiveDocument.Undo
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find number of coma and then add that number of rows in word using macro? PRA007 Word VBA 7 05-27-2015 10:45 PM
Get paragraph number from macro Figure number for repeated use in paragraph rahul4msoffice Word 1 05-01-2013 11:35 PM
How place paragraph number in a text box? peytontodd Word 2 12-13-2012 03:17 PM
Get paragraph number from macro How set up a 'paragraph number'? peytontodd Word 2 12-11-2012 06:55 PM
Get paragraph number from macro How to identify the paragraph number you are on SaneMan Word VBA 1 05-18-2011 05:43 AM

Other Forums: Access Forums

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