Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2007

Tip: Looking for answers? Try searching our database.

Exiting from a textbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roderick O'Regan - 27 Feb 2007 09:50 GMT
I have a textbox into which my procedure has inserted an inlineshape -
a photo for a CV.
The code next causes the selection to collapse within the text box.

I now want to break out of that text box and cause the selection point
to move to paragraph mark close by.

Manually, I've figured out to achieve this I would press ESC key
twice. I've translated this to some code and arrived at the following:
   With Selection
   .ShapeRange.TextFrame.TextRange.Select
   .Collapse
   .ShapeRange.Select
   .Collapse
   End With
Nothing! The cursor justs sits inside the box.
I've tried using the ("\Page") bookmark to break out but still no joy.

Reading through this newsgroup I've seen some great code to make
txtboxes even do cartwheels but nothing on how to get out of the pesky
critters.

Can anyone help, please?

Roderick
Shauna Kelly - 27 Feb 2007 11:19 GMT
Hi Roderick

Assuming that the cursor is within a text box, then the following will
select the paragraph to which the text box is anchored. You can see the
anchors by doing Tools > Options > View and ticking the "Object anchors"
box.

Sub SelectShapeAnchor()

Dim tb As Shape

   Set tb = Selection.ShapeRange(1)

   tb.Anchor.Select
   Selection.Collapse wdCollapseStart

End Sub

Signature

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

>I have a textbox into which my procedure has inserted an inlineshape -
> a photo for a CV.
[quoted text clipped - 21 lines]
>
> Roderick
Roderick O'Regan - 01 Mar 2007 10:47 GMT
Thanks Shauna.

It works great.

Much appreciated.

Roderick

>Hi Roderick
>
[quoted text clipped - 13 lines]
>
>End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.