AutoFitText Property

Microsoft Publisher Visual Basic

constant that represents how Microsoft Publisher automatically adjusts the text font size and the TextFrame objects size for best viewing. Read/write.

PbTextAutoFitType can be one of these PbTextAutoFitType constants.
pbTextAutoFitBestFit Text frame size adjusts to fit text.
pbTextAutoFitNone Allows text to overflow the text frame.
pbTextAutoFitShrinkOnOverflow Text font reduces so text fits within the text frame.

expression.AutoFitText

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

The following example tests to see if the text frame has text, and if so, the AutoFitText property is set to best fit.

Sub TextFit()

    Dim tfFrame As TextFrame

    tfFrame = Application.ActiveDocument.MasterPages.Item(1).Shapes(1).TextFrame
    With tfFrame
        If .HasText = msoTrue Then .AutoFitText = pbTextAutoFitBestFit
    End With

End Sub