Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 08-18-2019, 01:59 PM
gmaxey gmaxey is offline Create bookmark from comma separated text Windows 10 Create bookmark from comma separated text Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



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
Create bookmark from comma separated text Nest IF statements with a text comma inbetween each IF statement AClaborn Excel 2 01-20-2015 12:07 PM
Create bookmark from comma separated text 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:43 AM.


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