View Single Post
 
Old 06-01-2018, 03:16 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
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