Accessing Wordart Styles Thru VBA

CaliKidd

Board Regular
Joined
Feb 16, 2011
Messages
173
I'm using Excel 2007 and I've learned that the macro recorder doesn't work when trying to format Wordart styles. It's my understanding that Microsoft didn't have time to get everything hooked up before releasing this Office version...

Any ways, can someone tell me what the VBA code would be to access the Wordart Style presets? I've been looking through the object model, but I can't seem to find them.

To be clear what I am referring to, from the Format menu, the 30 presets are in a section called "Wordart Styles." Next to the three A's there is a drop-down. When you click it, it'll display 20 presets for selected text and 10 presets for all text.

Also, to the right of the three A's, there are dropdowns for Text Fill, Text Outline, and Text Effects. I'd like to know how to access those through VBA too.

Thank you.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If anyone has Excel 2003 or 2010, could you create a simple Wordart object, then turn on the macro-recorder to record selecting the various Wordart styles and text effects presets in order to see what the code looks like? Thank you.
 
Upvote 0
Hi

See if this helps:

Code:
Sub Test()
Dim shpWA As Shape
 
Set shpWA = ActiveSheet.Shapes.AddTextEffect( _
    PresetTextEffect:=msoTextEffect18, _
    Text:="My test", _
    FontName:="Arial Black", _
    FontSize:=54, _
    FontBold:=msoFalse, _
    FontItalic:=msoFalse, _
    Left:=50, _
    Top:=50)
        
' change style
shpWA.ShapeStyle = msoShapeStylePreset2
    
With shpWA.TextFrame2.TextRange
    
    ' Change font
    .Font.Name = "Arial"
    .Font.Size = 80
    
    ' Change font colour
    .Font.Fill.ForeColor.RGB = vbBlue
    
    ' Change text outline
    .Font.Line.ForeColor.RGB = vbRed
    
    ' Add shadow
    .Font.Shadow.Type = msoShadow29
End With
 
Upvote 0
Thank you. I stepped through the code and it works, so now I'll experiment with it. I appreciate you taking the time to help out a fellow man.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top