M
Microsoft Newsgroups
I am trying to have Word 2000 (controlled by Access 2000) replace the
contents of named enclosing bookmarks. I want to preserve the original name
as well as the bookmark.
I understand that I cannot simply replace the text, but that I have to
locate the bookmark, delete it and replace it with another with the same
name. (It would, of course, simply be easier to replace the text!) This is
my procedure which keeps resulting in a "type mismatch" error when I go to
add the new bookmark:
Public Function DoBookmarks(BookmarkName As String, Optional ReplacementText
As String, Optional SaveTheBookmark As Boolean)
With ActiveDocument
If .Bookmarks.Exists(BookmarkName) = True Then
.Bookmarks(BookmarkName).Select
.Bookmarks(BookmarkName).Delete
If ReplacementText <> "" Then
.Bookmarks.Add Name:=BookmarkName, Range:=ReplacementText
End If
End If
End With
End Function
What am I doing wrong?
contents of named enclosing bookmarks. I want to preserve the original name
as well as the bookmark.
I understand that I cannot simply replace the text, but that I have to
locate the bookmark, delete it and replace it with another with the same
name. (It would, of course, simply be easier to replace the text!) This is
my procedure which keeps resulting in a "type mismatch" error when I go to
add the new bookmark:
Public Function DoBookmarks(BookmarkName As String, Optional ReplacementText
As String, Optional SaveTheBookmark As Boolean)
With ActiveDocument
If .Bookmarks.Exists(BookmarkName) = True Then
.Bookmarks(BookmarkName).Select
.Bookmarks(BookmarkName).Delete
If ReplacementText <> "" Then
.Bookmarks.Add Name:=BookmarkName, Range:=ReplacementText
End If
End If
End With
End Function
What am I doing wrong?