Showing posts with label Word VBA 5101 - This bookmark does not exist error. Show all posts
Showing posts with label Word VBA 5101 - This bookmark does not exist error. Show all posts

Monday, March 31, 2008

Check Existence of BookMark using VBA (Word VBA)

Find BookMarks using VBA

BookMarks are vital in Word. However, when you look for a particular bookmark using VBA, it will cease to exist causing 5101 - This bookmark does not exist error.

To avoid this it is better to use Exists Method to check if the Bookmark exist.

Sub Check_If_BookMark_Exists()

If ActiveDocument.Bookmarks.Exists("TempBKMK") = True Then
ActiveDocument.Bookmarks("TempBKMK").Range.Text = "Something"
End If

End Sub


Exists method determines whether the specified bookmark or task exists. Returns True if the bookmark or task exists
Related Posts Plugin for WordPress, Blogger...
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.