excelledsoftware, I hope you don't mind me asking a bunch of questions but learning how to use VBA coding will often save me quite a bit of time.
I have been adapting your sub routine to change certain lines to different colors individually with no problem. However, in learning to use VBA properly I am trying to write code that will do this all at once and have ran into a bit of bother.
I have attached the PowerPoint file which I have been practicing on.
This is the code I've been trying to use to change multiple line colors and also the line weight of the black lines (this changes the text boxes' outline too for some reason). Any critique you can offer would be great.
Code:
Sub ChangeMultipleLineColors()
Dim sld As Slide, shp As Shape, PurpleColor(1) As Long, WhiteColor(1) As Long, BlackColor(1) As Long, BlueColor(1) As Long, Arr As Byte
Dim CheckColor As Long
'Set GrayColors
PurpleColor(1) = 16711807
WhiteColor(1) = 16777215
BlackColor(1) = 0
BlueColor(1) = 12611584
For Each sld In ActivePresentation.Slides
sld.Select 'not necessary but fun to watch
Debug.Print sld.SlideIndex 'again not necessary but useful if errors
For Each shp In sld.Shapes
If shp.Type <> msoGroup Then
shp.Select 'not necessary but fun to watch
CheckColor = shp.Line.ForeColor.RGB
If PurpleColor(1) = CheckColor Then
shp.Line.ForeColor.RGB = BlueColor(1) 'Purple to Blue
shp.Line.Weight = 1.5
If WhiteColor(1) = CheckColor Then
shp.Line.ForeColor.RGB = BlackColor(1) 'White to Black
shp.Line.Weight = 3 'Change Line Weight
End If
End If
End If
Next shp
Next sld
MsgBox "All Done Richard! Have a good day."
End Sub
Also, I have been trying to write a code which will just select all of the blue lines so I can animate these but for some reason it keeps selecting one black, dashed line.
Code:
Sub SelectBlueLines()
Dim sld As Slide, shp As Shape, GrayColor(1 To 2) As Long, Arr As Byte
Dim CheckColor As Long
'Set GrayColors
GrayColor(1) = 12611584
'White 16777215
'Blue 12611584
'Black 0
For Each sld In ActivePresentation.Slides
sld.Select 'not necessary but fun to watch
Debug.Print sld.SlideIndex 'again not necessary but useful if errors
For Each shp In sld.Shapes
If shp.Type <> msoGroup Then
shp.Select 'not necessary but fun to watch
CheckColor = shp.Line.ForeColor.RGB
If GrayColor(1) = CheckColor Then
shp.Select
End If
End If
Next shp
Next sld
MsgBox "All Done Richard! Have a good day."
End Sub
Finally, do you know what the line of code to change a line from solid to 'Dash Type: Square Dot'?
Thanks again for your help!