I have the following code inside a VB 6 app.:
This copies the entire contents of the bookmark including the variables which is great, however, it does not include the bookmark name.
I also tried:
I played with the above code by moving lines around with the same results. I tried InsertAfter but that did not preserve the bookmark name, variables or the formatting.
Here is how the destination doc and BKs look:
Some meaningless text here.
[Here is more text and I want to insert the new BK after this BK in a new paragraph.
paragraph mark]
[Here is yet more text where I want the new BK to insert before this BK.
paragraph mark]
Here is how the destination doc and BKs look after the insert:
Some meaningless text here.
[Here is more text and I want to insert the new BK after this BK in a new paragraph.
paragraph mark]
The new text is inserted beautifully along with formatting, etc... but the bookmark name is missing.
paragraph mark
[Here is yet more text where I want the new BK to insert before this BK.
paragraph mark]
Any help/advice will be greatly appreciated.
Code:
BKSource.Bookmarks("CopyMe").Range.Copy
Set RangeInsertAfter = BKDestination.Bookmarks("PasteAfterMe").Range
RangeInsertAfter.Collapse Direction:=wdCollapseEnd
RangeInsertAfter.Paste
I also tried:
Code:
Set RangeInsertAfter = BKDestination.Bookmarks("PasteAfterMe").Range
RangeInsertAfter.Collapse Direction:=wdCollapseEnd
BKSource.Bookmarks.Application.Selection.GoTo What:=wdGoToBookmark, Name:="CopyMe"
BKSource.Bookmarks.Application.Selection.Copy
RangeInsertAfter.Paste
Here is how the destination doc and BKs look:
Some meaningless text here.
[Here is more text and I want to insert the new BK after this BK in a new paragraph.
paragraph mark]
[Here is yet more text where I want the new BK to insert before this BK.
paragraph mark]
Here is how the destination doc and BKs look after the insert:
Some meaningless text here.
[Here is more text and I want to insert the new BK after this BK in a new paragraph.
paragraph mark]
The new text is inserted beautifully along with formatting, etc... but the bookmark name is missing.
paragraph mark
[Here is yet more text where I want the new BK to insert before this BK.
paragraph mark]
Any help/advice will be greatly appreciated.