Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Contents of a bookmark

Status
Not open for further replies.

amg2

Computer
Aug 18, 2003
2
I don't know how to watch the bookmark contents on the screen. I have typed the following:

dim lbookmark as string

If ActiveDocument.Bookmarks.Exists("BMK_Phone1") = True Then
ActiveDocument.Bookmarks("BMK_Phone1").Range.Text = "Pepe"
End If

lbookmark = ActiveDocument.Bookmarks("BMK_Phone1").Range.Text

If ActiveDocument.Bookmarks("BMK_Phone1").Range.Text = "Pepe" Then
Msgx = "Phone1 value is Pepe"
Tit = "Warning"
rc = MsgBox(Msgx, vbOKOnly, Tit)
Else
Msgx = "Phone1 value is " & lbookmark
Tit = "Warning"
rc = MsgBox(Msgx, vbOKOnly, Tit)
End If

The result after running this lines is lbookmark="" instead of Pepe and I don't know why. Anyone knows what's the problem?

Thank you very much.
 
Replies continue below

Recommended for you

Shouldn't the exist check perhaps be :

If ActiveDocument.Bookmarks("BMK_Phone1").Exists=True Then
 
sounds more logical to me, yeah

Cyril Guichard
Mechanical Engineer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor