Sorry about the the late reply but I did notice that not all of the gray lines are the same kind of gray. That poses a huge problem with writing a basic code. The first thing to do is to write a procedure that will tell us all of the line color numbers.
Follow along with the simple code that does nothing more than give us the line color for each shape on slide 1. This is a great way to see a loop work.
Now everytime I go to explain something in the code I will use a ' This represents a comment in VBA. Comments are not code executed but rather a message to the programmer or anybody looking over the code.
Here we go.
Code:
Sub GetTheLineColors()
'This is the very first thing you write for every procedure. Sub
'Just tells VBA that you are writing a sub routine.
'The GetTheLineColors is just a name I came up with. You can use
'Whatever you want but it can contain most special characters
'and no spaces. The () will be written automatically for you as well
'as an End Sub
Dim shp As Shape
'Here we use the Dim keyword that is used to DECLARE a variable.
'I will not go over variables in detail here just know that a variable
'Holds information so it can be used throughout the code.
'You can use almost whatever name for a variable you want.
'I used shp because it makes the most sense. and Shape is already taken
'because it is used in PPT VBA already just like I could not make a variable called
'ActivePresentation.
For Each shp In ActivePresentation.Slides(1).Shapes
'There are several loops available. This one is called the for each
'It basically says that FOR this instance do something
'In this case it is going to go through each shape in the
'Active presentation's Slides and shapes
'Notice I put in Slides(1) This checks just the first slide.
'When we write the second code you will see how we change that and why.
Debug.Print shp.Name & ";" & shp.Line.ForeColor.RGB
'Debug.print basically writes a string to the immediate window.
'in this case I have the shape name a ; and then the linecolor which
'is what we are after. I am separating the 2 with a ; so I can copy
'and paste the result into Excel and separate them into columns.
Next shp
'For any loop you need to tell it to keep going. The For loop
'Uses the next statement which says "now that you are done with that
'code block move to the next shape and continue until EACH shape has been
'visited.
'Remember how I said End Sub would be written in. Here it is
'This tell VBA that the procedure is over
End Sub
Now that was quite a bit to go over but again you are just getting your feet wet here.
Once I ran that code I copy and pasted the result into Excel and then I manually changed all of the "Gray" lines to a consistent green color. Then I ran the the same script again and compared how many Gray variations there are.
Here are the results.
10921638
12287562
So there are 2 possibilities of Gray lines here. 2 is not that big of a deal since an
IF statement could easily check 2 conditions but since you will want to be able to
do this in the future you will be learning about arrays as well and we will need to put another loop into our next procedure but first you need to use the code above and try this yourself. It's important to understand how the loop works. What would be awesome is if you could use the loop to identify what line color of blue you are looking for. Post that and I will continue to write the code for the next part since it still needs something else.