Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-01-2018, 03:16 PM
macropod's Avatar
macropod macropod is offline Replacing text held in all bookmarks Windows 7 64bit Replacing text held in all bookmarks Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The problem isn't with anything that Graham or I posted but with the the wrong kind of loop being used in your own code. Try:
Code:
Sub UpdateBookmarks()
Dim i As Long
With ActiveDocument
  For i = 1 To .Bookmarks.Count
    With .Bookmarks(i)
      Call UpdateBM(.Name, InputBox("Please enter " & .Name))
    End With
  Next
End With
End Sub

Sub UpdateBM(bmName As String, bmContent As String)
Dim bmRng As Word.Range
With ActiveDocument
  Set bmRng = .Bookmarks(bmName).Range
  bmRng.Text = bmContent
  .Bookmarks.Add bmName, bmRng
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
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 11:14 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