AddTextEffect Method

Microsoft Word Visual Basic

Adds a WordArt shape to a drawing canvas. Returns a Shape object that represents the WordArt and adds it to the CanvasShapes collection.

expression.AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold, FontItalic, Left, Top)

expression    Required. An expression that returns a CanvasShapes object.

PresetTextEffect   Required MsoPresetTextEffect. A preset text effect. The values of the MsoPresetTextEffect constants correspond to the formats listed in the WordArt Gallery dialog box (numbered from left to right and from top to bottom).

MsoPresetTextEffect can be one of these MsoPresetTextEffect constants.
msoTextEffect1
msoTextEffect10
msoTextEffect11
msoTextEffect12
msoTextEffect13
msoTextEffect14
msoTextEffect15
msoTextEffect16
msoTextEffect17
msoTextEffect18
msoTextEffect19
msoTextEffect2
msoTextEffect20
msoTextEffect21
msoTextEffect22
msoTextEffect23
msoTextEffect24
msoTextEffect25
msoTextEffect26
msoTextEffect27
msoTextEffect28
msoTextEffect29
msoTextEffect3
msoTextEffect30
msoTextEffect4
msoTextEffect5
msoTextEffect6
msoTextEffect7
msoTextEffect8
msoTextEffect9
msoTextEffectMixed

Text   Required String. The text in the WordArt.

FontName   Required String. The name of the font used in the WordArt.

FontSize   Required Single. The size (in points) of the font used in the WordArt.

FontBold   Required MsoTriState. MsoTrue to bold the WordArt font.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this argument.
msoFalse Sets the font used in the WordArt to regular.
msoTriStateMixed Not used with this argument.
msoTriStateToggle Not used with this argument.
msoTrue Sets the font used in the WordArt to bold.

FontItalic   Required MsoTriState. MsoTrue to italicize the WordArt font.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this argument.
msoFalse Sets the font used in the WordArt to regular.
msoTriStateMixed Not used with this argument.
msoTriStateToggle Not used with this argument.
msoTrue Sets the font used in the WordArt to italic.

Left    Required Single. The position, measured in points, of the left edge of the WordArt shape relative to the left edge of the drawing canvas.

Top    Required Single. The position, measured in points, of the top edge of the WordArt shape relative to the top edge of the drawing canvas.

ShowAddTextEffect method as it applies to the Shapes object.

Adds a WordArt shape to a document. Returns a Shape object that represents the WordArt and adds it to the Shapes collection.

expression.AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold, FontItalic, Left, Top, Anchor)

expression    Required. An expression that returns a Shapes object.

PresetTextEffect   Required MsoPresetTextEffect. A preset text effect. The values of the MsoPresetTextEffect constants correspond to the formats listed in the WordArt Gallery dialog box (numbered from left to right and from top to bottom).

MsoPresetTextEffect can be one of these MsoPresetTextEffect constants.
msoTextEffect1
msoTextEffect10
msoTextEffect11
msoTextEffect12
msoTextEffect13
msoTextEffect14
msoTextEffect15
msoTextEffect16
msoTextEffect17
msoTextEffect18
msoTextEffect19
msoTextEffect2
msoTextEffect20
msoTextEffect21
msoTextEffect22
msoTextEffect23
msoTextEffect24
msoTextEffect25
msoTextEffect26
msoTextEffect27
msoTextEffect28
msoTextEffect29
msoTextEffect3
msoTextEffect30
msoTextEffect4
msoTextEffect5
msoTextEffect6
msoTextEffect7
msoTextEffect8
msoTextEffect9
msoTextEffectMixed

Text   Required String. The text in the WordArt.

FontName   Required String. The name of the font used in the WordArt.

FontSize   Required Single. The size, in points, of the font used in the WordArt.

FontBold   Required MsoTriState. MsoTrue to bold the WordArt font.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this argument.
msoFalse Sets the font used in the WordArt to regular.
msoTriStateMixed Not used with this argument.
msoTriStateToggle Not used with this argument.
msoTrue Sets the font used in the WordArt to bold.

FontItalic   Required MsoTriState. MsoTrue to italicize the WordArt font.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this argument.
msoFalse Sets the font used in the WordArt to regular.
msoTriStateMixed Not used with this argument.
msoTriStateToggle Not used with this argument.
msoTrue Sets the font used in the WordArt to italic.

Left    Required Single. The position, measured in points, of the left edge of the WordArt shape relative to the anchor.

Top    Required Single. The position, measured in points, of the top edge of the WordArt shape relative to the anchor.

Anchor    Optional Variant. A Range object that represents the text to which the WordArt is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the WordArt is positioned relative to the top and left edges of the page.

Remarks

When you add WordArt to a document, the height and width of the WordArt are automatically set based on the size and amount of text you specify.

Example

ShowAs it applies to the CanvasShapes object.

This example adds a drawing canvas to a new document and inserts a WordArt shape inside the canvas that contains the text "Hello, World."

Sub NewCanvasTextEffect()
    Dim docNew As Document
    Dim shpCanvas As Shape

    'Create a new document and add a drawing canvas
    Set docNew = Documents.Add
    Set shpCanvas = docNew.Shapes.AddCanvas( _
        Left:=100, Top:=100, Width:=150, _
        Height:=50)

    'Add WordArt shape to the drawing canvas
    shpCanvas.CanvasItems.AddTextEffect _
        PresetTextEffect:=msoTextEffect20, _
        Text:="Hello, World", FontName:="Tahoma", _
        FontSize:=15, FontBold:=msoTrue, _
        FontItalic:=msoFalse, _
        Left:=120, Top:=120
End Sub
				

ShowAs it applies to the Shapes object.

This example adds WordArt that contains the text "This is a test" to the active document, and then it anchors the WordArt to the first paragraph.

Sub NewTextEffect()
    ActiveDocument.Shapes.AddTextEffect _
        PresetTextEffect:=msoTextEffect11, _
        Text:="This is a test", FontName:="Arial Black", _
        FontSize:=36, FontBold:=msoTrue, _
        FontItalic:=msoFalse, Left:=1, Top:=1, _
        Anchor:=ActiveDocument.Paragraphs(1).Range
End Sub