• VBA code to change all boxes in SmartArt hierarchy chart graphic

    Home » Forums » AskWoody support » Productivity software by function » MS PowerPoint and presentation apps » VBA code to change all boxes in SmartArt hierarchy chart graphic

    Author
    Topic
    #498501

    I see in ppt there is not an option to record a macro like in Excel.

    Is there a way in ppt to select all boxes in a hierarchy chart a change the shape outline to a weight of 1 pt?

    Is there also a website anybody knows of which can help me to understand other attributes of the boxes I could change?

    Viewing 2 reply threads
    Author
    Replies
    • #1489080

      You need to say which version you have. vba support for Smart Art is nearly non existant in version 2007 but better in 2010 on.

    • #1489112

      Hi John,

      2010

      • #1489119

        Hi John,

        2010

        I would say the easiet way is to treat the parent shape as a group.

        This should get you started (change the shape type if needed)

        Code:
        Sub S_Art()
        Dim oSA As SmartArt
        Dim oparent As Shape
        Dim i As Integer
        Dim s As Integer
        On Error Resume Next
        Err.Clear
        Set oSA = ActiveWindow.Selection.ShapeRange(1).SmartArt
        If Err  0 Then
        MsgBox “Error”
        Exit Sub ‘nothing selected or it’s not smart art
        End If
        Set oparent = oSA.Parent
        For i = 1 To oparent.GroupItems.Count
        ‘only target the shape type you want
        If oparent.GroupItems(i).AutoShapeType = msoShapeRectangle Then
        With oparent.GroupItems(i).Line
        .Visible = True
        .ForeColor.RGB = RGB(255, 0, 0)
        .Weight = 1
        End With
        End If
        Next i
        End Sub
    • #1489154

      Thanks John. I’ll give this a try.

    Viewing 2 reply threads
    Reply To: VBA code to change all boxes in SmartArt hierarchy chart graphic

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: