Alignment Property

Microsoft Publisher Visual Basic

Returns or sets a MsoTextEffectAlignment constant that represents the alignment for the specified text effect. Read/write.

MsoTextEffectAlignment can be one of these MsoTextEffectAlignment constants.
msoTextEffectAlignmentCentered
msoTextEffectAlignmentLeft
msoTextEffectAlignmentLetterJustify
msoTextEffectAlignmentMixed
msoTextEffectAlignmentRight
msoTextEffectAlignmentStretchJustify
msoTextEffectAlignmentWordJustify

expression.Alignment

expression    Required. An expression that returns a TextEffectFormat object.

ShowAlignment property as it applies to the ParagraphFormat object.

Returns or sets a PbParagraphAlignmentType constant that represents the alignment for the specified paragraphs. Read/write.

PbParagraphAlignmentType can be one of these PbParagraphAlignmentType constants.
pbParagraphAlignmentCenter
pbParagraphAlignmentDistribute
pbParagraphAlignmentDistributeAll
pbParagraphAlignmentDistributeCenterLast
pbParagraphAlignmentDistributeEastAsia
pbParagraphAlignmentInterCluster
pbParagraphAlignmentInterIdeograph
pbParagraphAlignmentInterWord
pbParagraphAlignmentJustified
pbParagraphAlignmentKashida
pbParagraphAlignmentLeft
pbParagraphAlignmentMixed
pbParagraphAlignmentRight

expression.Alignment

expression    Required. An expression that returns a ParagraphFormat object.

ShowAlignment property as it applies to the PhoneticGuide object.

Returns a PbPhoneticGuideAlignmentType constant that represents the position of phonetic characters above Japanese text. Read-only.

PbPhoneticGuideAlignmentType can be one of these PbPhoneticGuideAlignmentType constants.
pbPhoneticGuideAlignmentCenter
pbPhoneticGuideAlignmentDefault
pbPhoneticGuideAlignmentLeft
pbPhoneticGuideAlignmentOneTwoOne
pbPhoneticGuideAlignmentRight
pbPhoneticGuideAlignmentZeroOneZero

expression.Alignment

expression    Required. An expression that returns a PhoneticGuide object.

ShowAlignment property as it applies to the TabStop object.

Returns or sets a PbTabAlignmentType constant that represents the alignment for the specified tab stop. Read/write.

PbTabAlignmentType can be one of these PbTabAlignmentType constants.
pbTabAlignmentCenter
pbTabAlignmentDecimal
pbTabAlignmentLeading
pbTabAlignmentTrailing

expression.Alignment

expression    Required. An expression that returns a TabStop object.

Example

ShowAs it applies to the ParagraphFormat object.

This example adds a new text box to the first page of the active publication, and then add text and sets the paragraph alignment and font formatting.

Sub NewTextFrame()
    Dim shpTextBox As Shape
    Set shpTextBox = ActiveDocument.Pages(1).Shapes _
        .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
        Left:=72, Top:=72, Width:=468, Height:=72)
    With shpTextBox.TextFrame.TextRange
        .ParagraphFormat.Alignment = pbParagraphAlignmentCenter
        .Text = "Hello World"
        With .Font
            .Name = "Snap ITC"
            .Size = 30
            .Bold = msoTrue
        End With
    End With
End Sub

				

ShowAs it applies to the TabStop object.

This example enters a tabbed list and sets the alignment for two custom tab stops. This example assumes that the specified shape is a text frame and not another type of shape and that there are at least two custom tab stops already set.

Sub CustomDecimalTabStop()

    With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
        .InsertAfter Newtext:="Pencils" & vbTab & _
            "Each" & vbTab & "1.50" & vbLf
        .InsertAfter Newtext:="Pens" & vbTab & _
            "Each" & vbTab & "4.95" & vbLf
        .InsertAfter Newtext:="Folders" & vbTab & _
            "Box" & vbTab & "35.28" & vbLf
        .InsertAfter Newtext:="Envelopes" & vbTab & _
            "Case" & vbTab & "150.69" & vbLf
        With .Paragraphs(Start:=1).ParagraphFormat
            .Tabs(1).Alignment = pbTabAlignmentCenter
            .Tabs(2).Alignment = pbTabAlignmentDecimal
        End With
    End With
End Sub