AllCaps Property

Microsoft Publisher Visual Basic

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this property.
msoFalse All fonts within the range are not formatted as all caps.
msoTriStateMixed Returned if some fonts in the range are formatted as all caps and others not.
msoTriStateToggle Toggles between msoTrue and msoFalse.
msoTrue All fonts within the range are formatted with all caps.

expression.AllCaps

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

Remarks

Setting the AllCaps property to msoTrue sets the SmallCaps property to msoFalse, and vice versa.

Example

This example checks the selected text in the active document for text formatted as all capital letters. For this example to work, there must be be an active publication with text selected.

Public Sub Caps()

    If Publisher.ActiveDocument.Selection _
        .TextRange.Font.AllCaps = msoTrue Then
        MsgBox "Text is all caps."
    Else
        MsgBox "Text is not all caps."
    End If

End Sub
		

This example formats the selected text as all capital letters. For this code to execute properly, an active document must exist with selected text.

Public Sub MakeCaps()

    If Publisher.ActiveDocument.Selection.TextRange _
    .Font.AllCaps = msoFalse Then
            Selection.TextRange.Font.AllCaps = msoTrue
    Else
        MsgBox "You need to select some text" & _

" or it is already all caps."
    End If

End Sub