Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert a text box at the current cursor position?!?! 1

Status
Not open for further replies.

ftpdoo

Programmer
Aug 9, 2001
202
GB
Hi,

Does anyone know how I could insert a text box at the current cursor position??

If I do this I have to specify a specific location!

================================================
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 94.05, _
81.2, 234#, 72#).Select
================================================

Any ideas??
Jonathan..
 
Try using the Anchor property of the AddTextBox method. Something like:

Dim txb As Shape

Set txb = ActiveDocument.Shapes.addtextbox(msoTextOrientationHorizontal, _
0#, _
0#, _
234#, _
72#, _
Selection.Range)

i.e. using the Anchor property to place the text box relative to the current insertion point.

M :)
 
Sorry to ask a silly question, But.... I've never used the anchor property before. So how could I tell it to insert at the current position??

Jonathan
 
Setting the Anchor property to Selection.Range, and Top and Left to 0 WILL position the textbox at the current cursor position. If no value for Anchor is given, the text box will go at the Top and Left values used but relative to the top left hand corner of the page. Setting the Anchor value will redefine the origin.

M :)
 
Any idea's why I'd be getting an error saying that the text box is out of range??

Even though I'm using the same range values as a previous text box I placed by recording a macro??

Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top