Name

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

Synopsis

Adds a WordArt embedded object and returns the Shape object for the embedded object.

Argument

Settings

PresetTextEffect

An MsoPresetTextEffect constant. Can be msoTextEffect1 to msoTextEffect30.

Text

The text to embed.

FontName

The name of the font to use.

FontSize

The size of the font in points.

FontBold

True uses bold; False uses the normal weight font.

FontItalic

True uses italic font; False uses roman.

Left

The horizontal position of the shape in points.

Top

The vertical position of the shape in points.

Use the TextEffect property, not TextFrame, to change the text or appearance of the embedded WordArt object. The following code embeds a WordArt object, then changes its text:

Sub EmbedWordArt( )
    Dim ws As Worksheet, s As Shape
    Set ws = ActiveSheet
    ' Create label (height/width will be set by AutoSize).
    Set s = ws.Shapes.AddTextEffect(msoTextEffect19, "Wombat!", "Arial", 36, _
        True, False, 100, 100)
    ' Change text.
    s.TextEffect.text = "New Text"
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.