Solved

Select shape after autotext insertion

Posted on 2009-07-02
5
320 Views
Last Modified: 2012-05-07
I have an autotext entry which inserts some text and then it inserts a coloured text box. The problem I have is that I can't work out how to select the text box that was just inserted through this autotext entry.  I can't use shape.name as there could be multiples of this shape inserted. Can someone shed some light on this matter for me?  
ActiveDocument.AttachedTemplate.AutoTextEntries("Expanding Text Box").Insert Where:=Selection.Range, RichText:=True

Open in new window

0
Comment
Question by:Fi69
  • 3
  • 2
5 Comments
 
LVL 37

Expert Comment

by:Joanne M. Orzech
Comment Utility
Can you explain why you're using a textbox?
0
 

Author Comment

by:Fi69
Comment Utility
Hi there.  My template is a newsletter with coloured highlight boxes.  So they put a little bit of text in the coloured box that they want to draw the reader's attention to.
0
 
LVL 37

Accepted Solution

by:
Joanne M. Orzech earned 500 total points
Comment Utility
If the text box is set to be "inline with text" you could use the following code....
    NormalTemplate.AutoTextEntries("TestingTextBox").Insert Where:=Selection. _

        Range, RichText:=True

    Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend

Open in new window

0
 

Author Closing Comment

by:Fi69
Comment Utility
Didn't think of that!
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
Comment Utility
Great!  Thanks so much... glad I was able to help.

Joanne Orzech
MS Word MVP
EE Zone Advisor
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now