Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-05-2013, 05:05 AM
macropod's Avatar
macropod macropod is offline Delete Range After Bookmark? Windows 7 64bit Delete Range After Bookmark? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The proper way to update bookmark content is to add the content to the bookmark, not after it. Use code like:
Code:
Sub UpdateBookmark (wdDoc as Document, BmkNm as string, NewTxt as string)
Dim BmkRng as Word.Range
With wdDoc
  If.Bookmarks.Exists(BmkNm) Then
    Set BmkRng =.Bookmarks(BmkNm).Range
    BmkRng.Text = NewTxt
    .Bookmarks.Add BmkNm, BmkRng
  End if
End With
Set BmkRng = Nothing
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Range After Bookmark? Word VBA: Cannot Edit Range (Delete characters except the first in a table cell) tinfanide Word VBA 3 04-27-2012 09:48 AM
Delete Range After Bookmark? delete all bookmark text hklein Word VBA 4 08-10-2011 04:33 AM
Can't delete range - error 5904 expatriate Word VBA 1 06-03-2011 12:12 AM
Delete Range After Bookmark? Newbie: Delete Bookmark expatriate Word VBA 4 06-02-2011 01:12 AM
delete email message via blackberry and have it delete on my pop3 and my outlook Iamthestorm Outlook 2 10-28-2010 12:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft