Help with inline shapes  
Author Message
MonikaB





PostPosted: Thu Oct 11 06:53:19 PDT 2007 Top

MS Word VBA >> Help with inline shapes

Hello,

I am trying to make a DOT file with a number of text boxes set up as
inlineshapes. I can get them in the document fine (names in property list
of TBox1, Tbox2 etc), and they work with the dblclick event just fine but I
can not refer to them outside of the doubleclick event sub as inlineshapes
"don't have names".

The textbox has a name (like TBox1) and I can refer to it's name, but when
I try to pass it to another sub to work on the text, it fails - generally
telling me that the (name) method/property isn't valid. I tried to refer
to the textbox with the index from the inlineshapes collection, but I can
not find out which index number corresponds to the textbox.


Any help/directions is appreciated.

Jim

Word127  
 
 
Jonathan





PostPosted: Thu Oct 11 06:53:19 PDT 2007 Top

MS Word VBA >> Help with inline shapes


> Hello,
>
> I am trying to make a DOT file with a number of text boxes set up as
> inlineshapes. I can get them in the document fine (names in property list
> of TBox1, Tbox2 etc), and they work with the dblclick event just fine but
> I
> can not refer to them outside of the doubleclick event sub as inlineshapes
> "don't have names".
>
> The textbox has a name (like TBox1) and I can refer to it's name, but when
> I try to pass it to another sub to work on the text, it fails - generally
> telling me that the (name) method/property isn't valid. I tried to refer
> to the textbox with the index from the inlineshapes collection, but I can
> not find out which index number corresponds to the textbox.
>

The index number of any individual inlineshape is equal the number of
inlineshape in a Range that extends from the beginning of the document to
the position of the inlineshape under consideration. Therefore, if you have
the inlineshape selected, you can get the index number like this

InlineShapeIndex = ActiveDocument.Range(0, Selection.End).InlineShapes.Count

Or alternatively, you can in fact past the inlineshape object itself to a
subroutine as a paramater of type InlineShape.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup