Hi I was wondering if anyone knows how to append a string to the end of all of the bookmarks within a document and make sure the bookmark stays in the same place. I have tried the following code:-
Public Sub appendStringToBookmarks()
Dim i1 As Integer
Dim aBookMark As Bookmark
Dim aMarks() As String
Dim s1 As String
s1 = "_1"
If ActiveDocument.Bookmarks.Count >= 1 Then
ReDim aMarks(ActiveDocument.Bookmarks.Count - 1)
i1 = 0
For Each aBookMark In ActiveDocument.Bookmarks
aMarks(i1) = aBookMark.Name
aBookMark.Name = aMarks(i1) & s1
i1 = i1 + 1
Next aBookMark
End If
End Sub
Unfortunately the debugger falls down when attempting to change the aBookMark.Name property.
Can anyone advise a way around this or is creating a new bookmark and inserting it at the location of the current bookmark the only option?
Thanks in advance.