Forum Post: Inserting text at a bookmark without deleting the bookmark

  • Thread starter Thread starter 282
  • Start date Start date
Status
Not open for further replies.
2

282

Guest
Hi, I try to write in a Bookmark in MS-Word, but after I've written in a bookmark, the bookmark is removed. I can not find the right 4GL code for this I just find VSB code. Sub InsertInBookmarkI() Dim oRng As Word.Range Set oRng = ActiveDocument.Bookmarks("bmInBookmark").Range oRng.Text = ActiveDocument.Bookmarks("bmInBookmark").Range.Text & "Some text here." ActiveDocument.Bookmarks.Add "bmInBookmark", oRng lbl_Exit: Exit Sub End Sub Sub InsertInBookmarkII() Dim oRng As Word.Range Set oRng = ActiveDocument.Bookmarks("bmInBookmark").Range oRng.Text = ActiveDocument.Bookmarks("bmInBookmark").Range.Text & "Some more text here." ActiveDocument.Bookmarks.Add "bmInBookmark", oRng lbl_Exit: Exit Sub or 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

Continue reading...
 
Status
Not open for further replies.
Back
Top