You don't need to loop through bookmarks to see if it exists
Code:
Sub TestBookmark()
Dim oBM As Bookmark
If ActiveDocument.Bookmarks.Exists("code") Then
Set oBM = ActiveDocument.Bookmarks("code")
MsgBox oBM.Range.Text
Else
MsgBox "This bookmark doesn't exist" & vbCr & "code"
End If
End Sub