R
Rue
Hi all
I am hoping to use VBA to check if a document has a bookmark starting with a
particular string. I thought I could use LEFT to check if it exists but it
does not pick up the bookmark.
Checking if bookmark exits works perfectly when not using LEFT
Ive tried:
If ActiveDocument.Bookmarks.Exists(Left("_BD", 3)) = True Then
msgbox "Yes its here"
end if
I found that looping through the document works but I do want to search for
each bookmark eg:
Dim myBM As Bookmark
For Each myBM In ActiveDocument.Bookmarks
If ActiveDocument.Bookmarks.Exists(myBM.Name) And Left(myBM.Name, 3) =
"_BD" then
do this
End If
Next myBM
Any ideas?
Thanks in advance
I am hoping to use VBA to check if a document has a bookmark starting with a
particular string. I thought I could use LEFT to check if it exists but it
does not pick up the bookmark.
Checking if bookmark exits works perfectly when not using LEFT
Ive tried:
If ActiveDocument.Bookmarks.Exists(Left("_BD", 3)) = True Then
msgbox "Yes its here"
end if
I found that looping through the document works but I do want to search for
each bookmark eg:
Dim myBM As Bookmark
For Each myBM In ActiveDocument.Bookmarks
If ActiveDocument.Bookmarks.Exists(myBM.Name) And Left(myBM.Name, 3) =
"_BD" then
do this
End If
Next myBM
Any ideas?
Thanks in advance