Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 06-02-2018, 04:29 AM
gmaxey gmaxey is offline Replacing text held in all bookmarks Windows 7 32bit Replacing text held in all bookmarks Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

If you name your bookmarks with a logical processing manner in mind then yes.

Code:
Sub UpdateBookmarks()
Dim lngIndex As Long, lngPart As Long
Dim oRng As Range
Dim strName As String, strDisplay As String
Dim arrParts() As String
  With ActiveDocument
    For lngIndex = 1 To .Bookmarks.Count
      Set oRng = .Bookmarks(lngIndex).Range
      strName = .Bookmarks(lngIndex).Name
      arrParts = Split(strName, "_")
      If UBound(arrParts) > 0 Then
        'For processing bookmarks names using following convention: _
         A_Complany_Name, B_Company_Address, etc.
        strDisplay = vbNullString
        For lngPart = 1 To UBound(arrParts)
          strDisplay = strDisplay & " " & arrParts(lngPart)
        Next
        oRng.Text = InputBox("Please enter " & strDisplay)
      Else
        oRng.Text = InputBox("Please enter " & strName)
      End If
      .Bookmarks.Add strName, oRng
    Next
  End With
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
Replacing text held in all bookmarks Tracking Stock Shares Held/Sold & Current Value CCITE140 Excel 1 11-30-2015 07:42 AM
Replacing the 2nd or 3rd instance of Text wdillon2 Word VBA 2 05-13-2015 10:21 PM
Replacing text held in all bookmarks Problem replacing text. piritzo Word 2 06-22-2013 12:50 AM
Replacing text held in all bookmarks Help with replacing text with wildcards sbatson5 Word 2 04-13-2012 03:49 AM
Replacing / editting text LisaC Word 0 02-25-2010 03:40 AM

Other Forums: Access Forums

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