Rico
04-26-2006, 12:36 AM
Hi all
 
Info: I have a document containing a bookmark (always 8 characters). When the users are opening the document for the first time a form popup and ask the users for a value to the bookmark. Next time they opens the document I would like the document to check if the bookmark value is empty or not.
 
If empty the initial form “insert value” shall popup and if not a “do you want to change value” form shall popup.
 
 
Where do I stand? :think:
 
Inserting the value from textbox on form works fine, using:
 
Private Sub cmdOK_Click()
 
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("MyBookmark").Range.Text = txtMyTextbox.Value
End With
 
Application.ScreenUpdating = True
Unload Me
 
End Sub
 
Changing the value in bookmark with value from textbox on form works fine, using:
Private Sub cmdChange_Click()
ActiveDocument.Bookmarks("MyBookmark").Select
Selection.Delete Unit:=wdCharacter, Count:=8
 
ActiveDocument.Bookmarks.Add Range:=Selection.Range, _
Name:="MyBookmark"
 
Application.ScreenUpdating = False
 
With ActiveDocument
.Bookmarks("MyBookmark").Range.Text = txtMyTextbox.Value
End With
 
Application.ScreenUpdating = True
Unload Me
End Sub
 
But how do I check if the value of the bookmark is empty or not? And how do I show it in a textbox on a form? :dunno
 
Help please
Info: I have a document containing a bookmark (always 8 characters). When the users are opening the document for the first time a form popup and ask the users for a value to the bookmark. Next time they opens the document I would like the document to check if the bookmark value is empty or not.
If empty the initial form “insert value” shall popup and if not a “do you want to change value” form shall popup.
Where do I stand? :think:
Inserting the value from textbox on form works fine, using:
Private Sub cmdOK_Click()
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("MyBookmark").Range.Text = txtMyTextbox.Value
End With
Application.ScreenUpdating = True
Unload Me
End Sub
Changing the value in bookmark with value from textbox on form works fine, using:
Private Sub cmdChange_Click()
ActiveDocument.Bookmarks("MyBookmark").Select
Selection.Delete Unit:=wdCharacter, Count:=8
ActiveDocument.Bookmarks.Add Range:=Selection.Range, _
Name:="MyBookmark"
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("MyBookmark").Range.Text = txtMyTextbox.Value
End With
Application.ScreenUpdating = True
Unload Me
End Sub
But how do I check if the value of the bookmark is empty or not? And how do I show it in a textbox on a form? :dunno
Help please