This issue is related to the problem I had at link:
I'm using VBA in a Visual Basic 6 app.
I want to Insert a bookmark between two existing bookmarks which look like:
[Here is the first book mark's text of the BKDestination Doc which is a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
[Here is the second book mark's text of the BKDestination Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
I want to take a BK from another document (BKSource Doc) and insert it between these two BKs (after the first BK). This BK consists of similar text as the previous two:
[Here is the book mark's text of the BKSource Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
This works but unfortunately inserts the new BK (blue brackets) and it's text inside the BK of the Destinations BK (red brackets) so now it looks like:
[Here is the first book mark's text of the BKDestination Doc which is a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
[[Here is the book mark's text of the BKSource Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
Here is the second book mark's text of the BKDestination Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
There are other BKs in the document being inserted, some are between two existing BKs some are not. I don't have a problem where they're not not next to each other.
I've tried copying the range of the problem BK into another object so I can add it after I add the new BK but when I do this it still looks like the same mess as above.
There is code later on which deletes BKs so as you can see if the second BK from the Destination Doc gets deleted it'll take the new BK with it. I cannot delete first and add later because the one being deleted may be a BK needed to use to add a new BK after.
Any help will be greatly appreciated.
I'm using VBA in a Visual Basic 6 app.
I want to Insert a bookmark between two existing bookmarks which look like:
[Here is the first book mark's text of the BKDestination Doc which is a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
[Here is the second book mark's text of the BKDestination Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
I want to take a BK from another document (BKSource Doc) and insert it between these two BKs (after the first BK). This BK consists of similar text as the previous two:
[Here is the book mark's text of the BKSource Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
Code:
BKSource.Bookmarks(strBookmark).Range.Copy
Set RangeInsertAfter = BKDestination.Bookmarks(strBookMarkInsertAfter).Range
RangeInsertAfter.Collapse Direction:=wdCollapseEnd
RangeInsertAfter.Paste
RangeInsertAfter.Bookmarks.Add strBookmark
This works but unfortunately inserts the new BK (blue brackets) and it's text inside the BK of the Destinations BK (red brackets) so now it looks like:
[Here is the first book mark's text of the BKDestination Doc which is a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
[[Here is the book mark's text of the BKSource Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
Here is the second book mark's text of the BKDestination Doc which is also a couple paragraphs and includes docvariables and the paragraph mark at the end which is located on the next line.
paragraph mark]
There are other BKs in the document being inserted, some are between two existing BKs some are not. I don't have a problem where they're not not next to each other.
I've tried copying the range of the problem BK into another object so I can add it after I add the new BK but when I do this it still looks like the same mess as above.
There is code later on which deletes BKs so as you can see if the second BK from the Destination Doc gets deleted it'll take the new BK with it. I cannot delete first and add later because the one being deleted may be a BK needed to use to add a new BK after.
Any help will be greatly appreciated.