PDA

View Full Version : Solved: TestFrame Ranges



qazpl
11-30-2006, 07:00 AM
ms word 03

I have a document with many inserted textboxes (Insert => TextBox), I wan't to run a macro on textbox text that is selected. For the macro I need to be able to Identify in the macro the parent textbox or shape. so I tried

Selection.Range.Parent

and all I got was the parent Document which doesen't realy help me. Any Help Appreciated

qazpl

TonyJollans
11-30-2006, 02:11 PM
If the Selection is a single Textbox, or is in a Textbox then:
Selection.StoryType = wdTextFrameStory
and:
Selection.ShapeRange(1).TextFrame should be the Textbox.

But, if the Selection is a single shape, and just a single shape, - a picture, say, - within a Textbox, then Selection.ShapeRange will fail and some special case code will be needed.

qazpl
11-30-2006, 09:23 PM
Thanks it works