Search code examples
vbapowerpoint

change the color and thickness of the font border of a powerpoint wordart from vba


How can I change the color and thickness of the font border of a powerpoint wordart from vba? I'm trying with .TextFrame.TextRange but I can't find the way

I have an old web page that generates a powerpoint file and I want to modify the border of the letter of the texts in wordart that it contains


Solution

  • Lots of things that you can do in Powerpoint, you can do also in Excel (eg Wordart). So if you have Excel (or Word), do the actions you want to do there and record a Macro to get an idea about the properties you need to change.

    Setting the character formatting for text can be done via TextFrame2.Characters. In your case, change properties of Font.Line.

    Dim slide As slide
    For Each slide In ActivePresentation.Slides
        Dim sh As Shape
        For Each sh In slide.Shapes
            If sh.HasTextFrame Then
                With sh.TextFrame2.TextRange.Characters.Font.Line
                    If .Visible Then  ' Prevent changing "normal" text
                        ' Adapt the following lines to your need
                        .ForeColor.ObjectThemeColor = msoThemeColorAccent2
                        .ForeColor.TintAndShade = 0
                        .ForeColor.Brightness = -0.25
                        .Weight = 1
                        .Transparency = 0
                    End If
                End With
            End If
        Next
    Next