Make Text Box in Macro

K

Kay

How can I record a macro that contains a text box? Since
the mouse cannot be used during the recording of a maco, I
cannot draw the textbox.

Any ideas? Thanks.
 
C

Cindy M -WordMVP-

Hi Kay,
How can I record a macro that contains a text box? Since
the mouse cannot be used during the recording of a maco, I
cannot draw the textbox.
You can do something like this:

Sub DrawATextbox()
Dim shp as Word.Shape

Set shp = _
ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=120, Top:= 120, _
Width:=300, Height:=50

With shp
.Left = 50
.Top = 100
End With
End Sub

Depending on which version of Word you have, the Left, Top,
Width and Height may not work when you're doing the actual
inserting. So you use the With shp...End With to set anything
you want to change after it's been inserted. If you set up a
macro like this, then in an empty line between With shp...End
With press the period key(.), you should get a list of things
you can use.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top