Retrieving the contents of the Bookmark into another Document

L

LA Lawyer

I am using Word 2007.

I want to retrieve (insert) the contents of a bookmark in another file into
a bookmark in the currently open file. How is that done?
 
D

Doug Robbins - Word MVP

You do not really need a macro to do that. It can be done by used of an {
INCLUDETEXT "filename" [bookmark] } field.

To do it using a macro

Dim Source as Document, Target as Document
Set Target = ActiveDocument
Set Source =
Documents.Open("Path\Filenameofdocumentcontainingthebookmarkedtext.doc")
Target.Bookmarks("Nameofbookmarkwhereyouwantthetextinserted").Range.Text =
Source.Bookmarks("Nameofbookmarkcontainingthetextthatyouwantinserted").Range.Text
Source.Close wdDoNotSaveChanges

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top