![]() |
|
#8
|
|||
|
|||
|
Based on what you have shown and described:
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim varFactors
Dim lngIndex As Long
Dim strFind As String
Dim oRng As Range
Dim strDesc As String
varFactors = Split(Selection.Text, ",")
strDesc = InputBox("Enter a decriptor")
For lngIndex = 0 To UBound(varFactors)
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = Trim(varFactors(lngIndex))
.MatchCase = True
While .Execute
If oRng.InRange(Selection.Range) Then
'If you need to expand the range of the defined text do it here before applying the BM
oRng.Bookmarks.Add strDesc & lngIndex + 1, oRng
End If
oRng.Collapse wdCollapseEnd
Wend
End With
Next
lbl_Exit:
Exit Sub
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| using bookmark feature in Word to create index | Indexer | Word | 6 | 02-19-2017 12:28 PM |
| Create bookmark and use it in macrobutton | fusion001 | Word VBA | 3 | 05-28-2015 02:00 AM |
Nest IF statements with a text comma inbetween each IF statement
|
AClaborn | Excel | 2 | 01-20-2015 12:07 PM |
Word 2003 - IncludeText Does Not Include Bookmark Text if in a Form Text Control
|
skarden | Word | 1 | 12-12-2011 10:39 PM |
| adding text on a separated column line | ahmet1985 | Word | 0 | 03-27-2010 07:10 AM |