Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

How to have fields the will overwrite old information???

Status
Not open for further replies.

kristofor

Programmer
Sep 4, 2003
1
AU
Hi,
Ok i have a bookmark in word. And i have a user form. There is a field in the userform for a persons surname. Now i go to that bookmark and i insert and everything works fine. Now how would i make it so i can have things like - and a space stuff like that and then when i click insert a 2nd time i want to be able to overwrite everything that got inserted the first time. and so on,
does anyone know how to do it???

thanks
 
Use the following sub. It works for me.

Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub

Then use the syntax below in your main program:

UpdateBookmark "NameOfYourBookmark1", tbBookmark1.Text
UpdateBookmark "NameOfYourBookmark2", tbBookmark2.Text

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top