ThreeDFormat

Use the ThreeDFormat object to add a 3-D effect to shapes. Use the Shape object’s ThreeD property to get a reference to this object. The ThreeDFormat object has the following members:

Application

Creator

Depth

ExtrusionColor

ExtrusionColorType

IncrementRotationX

IncrementRotationY

Parent

Perspective

PresetExtrusionDirection

PresetLightingDirection

PresetLightingSoftness

PresetMaterial

PresetThreeDFormat

ResetRotation

RotationX

RotationY

SetExtrusionDirection

SetThreeDFormat

Visible

The ThreeDFormat members correspond to the settings on the 3-D Settings toolbar shown in Figure 18-16.

Adding a 3-D effect to shapes

Figure 18-16. Adding a 3-D effect to shapes

Use the SetThreeDFormat method to apply a 3-D effect to a shape. The following code draws the wave shape shown in Figure 18-16 and applies a 3-D effect to it:

Sub ThreeDFormatMembers( )
    Dim ws As Worksheet, s As Shape, fil As String
    Set ws = ActiveSheet
    ' Insert embedded WordArt.
    Set s = ws.Shapes.AddShape(msoShapeWave, 20, 140, 40, 30)
    s.Fill.Solid
    ' Apply 3-D effect.
    s.ThreeD.SetThreeDFormat msoThreeD1
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.