OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy |
How can I access the new text effects?
PowerPoint 2007 introduced the several font formatting options in PPT 2007. However if you try to access them thru the TextFrame object you will meet with little success. If you access the Font object available within the new TextFrame2 object, it actually returns a Font2 class object which has all the new font formatting options. All of these properties are read/write.
|
Sub TextFrame2Listing() Dim oFont As Font2 Set oFont = ActivePresentation.Slides(1).Shapes(1).TextFrame2.TextRange.Font With oFont Debug.Print "Allcaps: " & .Allcaps Debug.Print "Bold: " & .Bold Debug.Print "Caps: " & .Caps Debug.Print "DoubleStrikeThrough: " & .DoubleStrikeThrough Debug.Print "Embeddable: " & .Embeddable Debug.Print "Embedded: " & .Embedded Debug.Print "Equalize: " & .Equalize Debug.Print "Highlight: " & .Highlight Debug.Print "Italic: " & .Italic Debug.Print "Kerning: " & .Kerning Debug.Print "Size: " & .Size Debug.Print "Smallcaps: " & .Smallcaps Debug.Print "SoftEdgeFormat: " & .SoftEdgeFormat Debug.Print "Spacing: " & .Spacing Debug.Print "Strike: " & .Strike Debug.Print "Strikethrough: " & .Strikethrough Debug.Print "Subscript: " & .Subscript Debug.Print "Superscript: " & .Superscript Debug.Print "UnderlineColor: " & .UnderlineColor Debug.Print "UnderlineStyle: " & .UnderlineStyle Debug.Print "WordArtFormat: " & .WordArtFormat End With End Sub |
Some of the Font2 class members are objects which have additional properties for formatting. Namely Glow, Shadow and Reflection. Look here to assign a glow to the shape. Lets see how to read the Reflection information.
To set this up: 1. Draw a shape on the slide. 2. Type some text in the shape. 3. Select the text and assign a reflection text effect (I chose 'Tight reflection and touching' from the UI. 4. Select the shape and then run this macro. |
|
Sub TextFrame2Reflection() Dim oFont As Font2 Set oFont = ActivePresentation.Slides(1).Shapes(1).TextFrame2.TextRange.Font With oFont.Reflection Debug.Print .Type End With End With End Sub |
|
The value returned is 1 or msoReflectionType1. There are 11 enum value for msoReflectionType msoReflectionType1 to msoReflectionType9 (corresponding to 9 available in the PowerPoint UI), msoReflectionTypeNone and msoReflectionTypeMixed. A similar reflection object is available for the shape object. |
|
Copyright 1999-2016 (c) Shyam Pillai. All rights reserved.