Autosize for TextBoxes

M

Mojeaux65

Hi,
I'm somewhat of a newbie to word vba. Is there a way to adjust the
text size so that you can see all of its contents... even if its 2
lines or 20 lines? I've tried adjusting the TextBox2 properties to:
Autosize: True
MaxLength: 850
MultiLine: True
Height: 15
Width: 9.75 - 475
WordWrap: True

With these settings, It only allows me to type 1-2 characters before
going to the next line. Without Autosize, I can type about 10-12
lines before you are unable to see the rest of the text.

I need to have the text box automatically change size to fit its
content. Is there a way to do this with vba code? Any help would be
appreciated! Thx, Mojeaux
 
G

Greg Maxey

Sub ScratchMacro()
Dim oShp As Shape
For Each oShp In ActiveDocument.Shapes
If oShp.Type = msoTextBox Then
oShp.TextFrame.AutoSize = True
End If
Next oShp
ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview
End Sub
 

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