#1
|
|||
|
|||
Loop thru document and create bookmarks
I have numbered paragraphs which start with the word Step followed by a sequence field.
Step {SEQ MyStep } 1.1. Step 1 1.2. Step 2 1.3. This is a paragraph without a step 1.4. Step 3 1.5. This is a paragraph without a step 1.5. Step 4 etc How can I loop through the numbered paragraphs turning the Step 1 etc into bookmarks? It would be nice to have the bookmarks named MyStep1, MyStep2 and so on. |
#2
|
||||
|
||||
Is there a reason for using SEQ fields rather that Word's multi-level list numbering? The latter allows you insert a cross-reference to a numbered item without the need to create a bookmark.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Assuming this is an accurate reflection of your document and the numbers are outline numbers and not text then
Code:
Sub Macro1() 'Graham Mayor - http://www.gmayor.com - Last updated - 22 Sep 2018 Dim oPara As Range Dim iCount As Integer: iCount = 1 Dim iPara As Integer For iPara = 1 To ActiveDocument.Paragraphs.Count If ActiveDocument.Paragraphs(iPara).Range.Words(1) Like "Step*" Then Set oPara = ActiveDocument.Paragraphs(iPara).Range.Words(1) oPara.Bookmarks.Add "Step" & iCount iCount = iCount + 1 End If Next iPara lbl_Exit: Set oPara = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#4
|
|||
|
|||
Quote:
Create Sequence Fields for Interrogatories and More After the document is written by the user, I plan to have a customized ribbon for the user to create the bookmarks. I played around with the "Caption" option, but it appears if you enter a "Caption" right after the paragraph numbering, the numbering is removed in place of the caption. The Auto Text seems a better option. Quote:
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
split word document based on bookmarks with each new document title of the bookmark | megatronixs | Word VBA | 9 | 09-05-2020 02:29 PM |
How to create a list of bookmarks? | dharker | Word VBA | 5 | 10-19-2016 03:08 PM |
Create Index List Using Bookmarks in Alphabetical Order | priteshp108 | Word VBA | 8 | 11-16-2015 12:06 PM |
How do I create slideshow that plays on loop? | Olwen | PowerPoint | 1 | 08-25-2011 11:55 AM |
Using bookmarks in a protected document | Bill Stemp | Word | 0 | 10-16-2010 06:47 AM |