Assuming I have the following text:
Code:
Hello,
"BOOKMARK_START"
What are you doing
'BOOKMARK_END"
Call me
I want to delete the text within two bookmarks in Word to end up with:
I found this code:
Code:
Dim pRange
Dim dRange
Dim myrange
pRange = ActiveDocument.Bookmarks("BOOKMARK_START").Range.Start
dRange = ActiveDocument.Bookmarks("BOOKMARK_END").Range.End
Set myrange = ActiveDocument.Range(Start:=pRange, End:=dRange)
myrange.Cut
What happens when the code is run is BOOKMARK_START and BOOKMARK_END point to the same place, (which is BOOKMARK_START), ie:
Code:
Hello,
BOOKMARK_START / BOOKMARK_END
Call me
Next time I insert something into BOOKMARK_START (and then try to delete it), it won't recognise BOOKARK_END (because it's the same location as BOOKMARK_START).
How can I get round this?