Macro to insert a textbox

J

João Correia

Hi, i'd like to know how can I create a macro to insert a
textbox in a document, since it's not possible with the
recorder? (At least, I can't do it...)

Thanks,

João
 
D

Doug Robbins

Hi João,

ActiveDocument.Shapes.AddTextBox

This is the example from the Help file (When all else fails, try the help
file)

This example adds a text box that contains the text "Test" to a new
document.

Sub newTextbox()
Dim docNew As Document
Dim newTextbox As Shape

'Create a new document and add a text box
Set docNew = Documents.Add
Set newTextbox = docNew.Shapes.AddTextbox _
(Orientation:=msoTextOrientationHorizontal, _
Left:=100, Top:=100, Width:=300, Height:=200)

'Add text to the text box
newTextbox.TextFrame.TextRange = "Test"
End Sub

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
Hi, i'd like to know how can I create a macro to insert a
textbox in a document, since it's not possible with the
recorder? (At least, I can't do it...)

Thanks,

João
 

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