I have an embedded Word document within an open Word document. I would like
to create a macro that opens the desired embedded Word document and goes to a
predefined bookmark within it.

Does anyone know how to do this programmatically? I'm using Word 2000 but
the doc will be used by Word 2000 & 2003 users.


Thanks for your help!
--
JoAnn

RE: How to open an embedded Word doc using VBA? by ChuckHenrich

ChuckHenrich
Thu Aug 18 08:10:05 CDT 2005

The following code should get you started. It simply opens the first
InlineShape in the document and goes to the bookmark. It assumes your
embedded doc is inline, not floating - if it's floating then you need to use
Shapes instead of InlineShapes. This code is modified from code Cindy posted
in another thread
(http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.word.vba.general&mid=e2c111f2-4f15-46a9-8a50-097187515c9a&sloc=en-us)

Sub OpenEmbeddedDoc()
Dim shpInline As InlineShape
Dim docContainer As Document
Dim docEmbedded As Document
Dim olFormat As oleFormat

Set docContainer = ActiveDocument
Set olFormat = docContainer.Range.InlineShapes(1).oleFormat
olFormat.DoVerb wdOLEVerbPrimary
Set docEmbedded = olFormat.Object
docEmbedded.Bookmarks("hello").Range.Select
MsgBox "Is this your bookmark?"
Set docEmbedded = Nothing
End Sub

HTH
--
Chuck Henrich
www.ProductivityApps.com


"JoAnn" wrote:

> I have an embedded Word document within an open Word document. I would like
> to create a macro that opens the desired embedded Word document and goes to a
> predefined bookmark within it.
>
> Does anyone know how to do this programmatically? I'm using Word 2000 but
> the doc will be used by Word 2000 & 2003 users.
>
>
> Thanks for your help!
> --
> JoAnn

RE: How to open an embedded Word doc using VBA? by JoAnn

JoAnn
Mon Aug 22 13:20:04 CDT 2005

Thank you for this information. I will give it a try!
--
JoAnn


"Chuck Henrich" wrote:

> The following code should get you started. It simply opens the first
> InlineShape in the document and goes to the bookmark. It assumes your
> embedded doc is inline, not floating - if it's floating then you need to use
> Shapes instead of InlineShapes. This code is modified from code Cindy posted
> in another thread
> (http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.word.vba.general&mid=e2c111f2-4f15-46a9-8a50-097187515c9a&sloc=en-us)
>
> Sub OpenEmbeddedDoc()
> Dim shpInline As InlineShape
> Dim docContainer As Document
> Dim docEmbedded As Document
> Dim olFormat As oleFormat
>
> Set docContainer = ActiveDocument
> Set olFormat = docContainer.Range.InlineShapes(1).oleFormat
> olFormat.DoVerb wdOLEVerbPrimary
> Set docEmbedded = olFormat.Object
> docEmbedded.Bookmarks("hello").Range.Select
> MsgBox "Is this your bookmark?"
> Set docEmbedded = Nothing
> End Sub
>
> HTH
> --
> Chuck Henrich
> www.ProductivityApps.com
>
>
> "JoAnn" wrote:
>
> > I have an embedded Word document within an open Word document. I would like
> > to create a macro that opens the desired embedded Word document and goes to a
> > predefined bookmark within it.
> >
> > Does anyone know how to do this programmatically? I'm using Word 2000 but
> > the doc will be used by Word 2000 & 2003 users.
> >
> >
> > Thanks for your help!
> > --
> > JoAnn