次の方法で共有


Shapes.AddTextEffect Method (Word)

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

Syntax

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

expression Required. A variable that represents a Shapes collection.

Parameters

Name

Required/Optional

Data Type

Description

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).

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.

FontItalic

Required

MsoTriState

MsoTrue to italicize the WordArt font.

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.

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

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

See Also

Concepts

Shapes Collection Object

Shapes Object Members