Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using msoAutoSizeTextToFitShape in a textbox

36 views
Skip to first unread message

David Cuthill

unread,
Oct 6, 2021, 1:32:50 PM10/6/21
to
I have several chartsheets that I am creating and in each I add textboxes. Each text box is the same dimensions but the length of text varies. I thought as I write the text into the textbox I could use the msoAutoSizeTextToFitShape setting and the text (font size) would adjust to allow the complete length of the text to fit within the width of the shape.

This is what I am using ....

ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 550, _
50, 119, 18).Name = "textbox1"
With ActiveChart.TextBoxes("textbox1")
.ShapeRange.TextFrame2.wordwrap = msoFalse

.ShapeRange.TextFrame2.AutoSize = msoAutoSizeTextToFitShape

.Text = "Sand Loading - " & Format(Cs_PPA_o, "#.00") '"=Sheet1!a5"
With .Font
.Name = "Calibri"
End With
End With

The font size does not change to fit the shape.
0 new messages