Re: How do I get the Moniker Word uses for a Link?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Robin Tucker (idontwanttobespammedanymore_at_reallyidont.com)
Date: 10/04/04


Date: Mon, 4 Oct 2004 19:28:28 +0100

Nooooo. That won't work. The bookmark is a position in the document! If I
do that, then I'll still need the Moniker for the Embedded object either
way. I know where the item is in the document (I have it in the
InlineShapes collection after all!).

Apparently, Word doesn't do this very well (in fact, it sucks at doing it).

"Jean-Guy Marcil" <no-spam@leaveme.alone> wrote in message
news:%23%233B4zjqEHA.1152@TK2MSFTNGP11.phx.gbl...
> Bonjour,
>
> Dans son message, < Robin Tucker > écrivait :
> In this message, < Robin Tucker > wrote:
>
>> Ok, the target of the link is an object within an InlineShape within a
> word
>> document :)
>>
>> Consider the following:
>>
>> Document1.Doc contains an Embedded OLE object of the class
> MyCompany.MyShape
>>
>> MyCompany.MyShape implements IOleItemContainer, and I am able to fetch an
>> OLE Object called "Spot 1" from the IOleItemContainer it implements.
>>
>> Now, when I activate MyCompany.MyShape in Document1, I can Copy and Paste
>> Special..., a link from "Spot 1" into the document. So, whenever Spot 1
>> changes in my activated MyCompany.MyShape, its value is updated in the
> link
>> (this works at present using Copy/Paste).
>>
>> I know I can embed a link in my document using the Link field. However,
>> I
>> have no way of getting the Moniker for the link from Word. The Moniker I
>> found when recording the Copy/Paste into a Macro looked like this:
>> "Document3.doc" "_1158083192\\Spot 1". Ie. the object is in
>> Document3.Doc
>> (which happens to be the same document I want to embed the link into),
>> the
>> object is _1158083192 and the sub object within that object is "Spot 1".
> I
>> know about Document3.Doc and I know about "Spot 1", but in order to
>> create
>> the link, I need the Moniker Word gives the embedded object (ie. the
>> "_1158083192").
>>
>
> You got the "_1158083192" when you used Paste Special, right?
>
> You know that Word created the "_1158083192" and built the LINK field
> codes
> using that.
>
> So, have you tried assigning a bookmark to the InLine shape yourself and
> then create the LINK field in your code (Not by using Paste Special, but
> by
> adding a Field of the Type LINK, or by adding an empty field and adding in
> the field codes). This way you will use your own bookmark, not the one
> Word
> randomly creates when the Paste Special is done. And since you know the
> object name (Spot!, right?) it should be easy to build your own LINK field
> from scratch.
>
> I have never tried to build Link fields that way, so there may be other
> catches, but I think it is worth trying.
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>



Relevant Pages

  • Re: How do I get the Moniker Word uses for a Link?
    ... The bookmark is a position in the document! ... then I'll still need the Moniker for the Embedded object either ... >> I know I can embed a link in my document using the Link field. ... >> have no way of getting the Moniker for the link from Word. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: How do I get the Moniker Word uses for a Link?
    ... > Document1.Doc contains an Embedded OLE object of the class ... > have no way of getting the Moniker for the link from Word. ... You know that Word created the "_1158083192" and built the LINK field codes ...
    (microsoft.public.dotnet.framework.interop)
  • Re: How do I get the Moniker Word uses for a Link?
    ... > Document1.Doc contains an Embedded OLE object of the class ... > have no way of getting the Moniker for the link from Word. ... You know that Word created the "_1158083192" and built the LINK field codes ...
    (microsoft.public.word.vba.general)