Irakli Andguladze
Irakli Andguladze

Reputation: 97

How to change only line shape color in vba powerpoint

I have task to make colour fill in Powerpoint VBA. When I select lines and boxes I want to change lines only and leave the boxes colour. Is there a way to change only private shapes?

Upvotes: 1

Views: 11540

Answers (1)

Gareth
Gareth

Reputation: 5243

The below code will change all the line colours in slide 2 to red in Powerpoint 2007:

Public Sub ChangeLineColours()

Dim shp As Shape

For Each shp In ActivePresentation.Slides(2).Shapes '<~~ Change '2' to whichever slide you want to loop through
    If shp.Type = msoLine Then
        shp.Line.ForeColor.RGB = RGB(255, 0, 0)
    End If
Next shp

End Sub

Upvotes: 8

Related Questions