Sub RatingGraphic()
On Error GoTo SubError
Set objSlide = ppPres.Slides.Item(2)
With ppPres
With .Slides
' Green ----------------------------------------------------------------
If Rcolor(0) = 2 And Rcolor(1) = 2 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=235, Width:=15, Height:=14) '2 x 2
ElseIf Rcolor(0) = 2 And Rcolor(1) = 3 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=235, Width:=15, Height:=14) '2 x 3
ElseIf Rcolor(0) = 3 And Rcolor(1) = 2 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=252, Width:=15, Height:=14) '3 x 2
ElseIf Rcolor(0) = 3 And Rcolor(1) = 3 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=252, Width:=15, Height:=14) '3 x 3
ElseIf Rcolor(0) = 4 And Rcolor(1) = 2 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=269, Width:=15, Height:=14) '4 x 2
ElseIf Rcolor(0) = 4 And Rcolor(1) = 3 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=269, Width:=15, Height:=14) '4 x 3
ElseIf Rcolor(0) = 5 And Rcolor(1) = 2 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=286, Width:=15, Height:=14) '5 x 2
ElseIf Rcolor(0) = 5 And Rcolor(1) = 3 And Rcolor(2) = "Green" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=green1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=286, Width:=15, Height:=14) '5 x 3
End If
' Yellow ----------------------------------------------------------------------------------
If Rcolor(0) = 2 And Rcolor(1) = 2 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=235, Width:=15, Height:=14) '2 x 2
ElseIf Rcolor(0) = 2 And Rcolor(1) = 3 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=235, Width:=15, Height:=14) '2 x 3
ElseIf Rcolor(0) = 3 And Rcolor(1) = 2 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=252, Width:=15, Height:=14) '3 x 2
ElseIf Rcolor(0) = 3 And Rcolor(1) = 3 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=252, Width:=15, Height:=14) '3 x 3
ElseIf Rcolor(0) = 4 And Rcolor(1) = 2 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=269, Width:=15, Height:=14) '4 x 2
ElseIf Rcolor(0) = 4 And Rcolor(1) = 3 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=269, Width:=15, Height:=14) '4 x 3
ElseIf Rcolor(0) = 5 And Rcolor(1) = 2 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=286, Width:=15, Height:=14) '5 x 2
ElseIf Rcolor(0) = 5 And Rcolor(1) = 3 And Rcolor(2) = "Yellow" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=yellow1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=286, Width:=15, Height:=14) '5 x 3
End If
' Red -----------------------------------------------------------------------------------
If Rcolor(0) = 2 And Rcolor(1) = 2 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=235, Width:=15, Height:=14) '2 x 2
ElseIf Rcolor(0) = 2 And Rcolor(1) = 3 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=235, Width:=15, Height:=14) '2 x 3
ElseIf Rcolor(0) = 3 And Rcolor(1) = 2 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=252, Width:=15, Height:=14) '3 x 2
ElseIf Rcolor(0) = 3 And Rcolor(1) = 3 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=252, Width:=15, Height:=14) '3 x 3
ElseIf Rcolor(0) = 4 And Rcolor(1) = 2 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=269, Width:=15, Height:=14) '4 x 2
ElseIf Rcolor(0) = 4 And Rcolor(1) = 3 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=269, Width:=15, Height:=14) '4 x 3
ElseIf Rcolor(0) = 5 And Rcolor(1) = 2 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=286, Width:=15, Height:=14) '5 x 2
ElseIf Rcolor(0) = 5 And Rcolor(1) = 3 And Rcolor(2) = "Red" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=red1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=286, Width:=15, Height:=14) '5 x 3
End If
' Black -------------------------------------------------------------------------------------
If Rcolor(0) = 2 And Rcolor(1) = 2 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=235, Width:=15, Height:=14) '2 x 2
ElseIf Rcolor(0) = 2 And Rcolor(1) = 3 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=235, Width:=15, Height:=14) '2 x 3
ElseIf Rcolor(0) = 3 And Rcolor(1) = 2 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=252, Width:=15, Height:=14) '3 x 2
ElseIf Rcolor(0) = 3 And Rcolor(1) = 3 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=252, Width:=15, Height:=14) '3 x 3
ElseIf Rcolor(0) = 4 And Rcolor(1) = 2 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=269, Width:=15, Height:=14) '4 x 2
ElseIf Rcolor(0) = 4 And Rcolor(1) = 3 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=269, Width:=15, Height:=14) '4 x 3
ElseIf Rcolor(0) = 5 And Rcolor(1) = 2 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=628, Top:=286, Width:=15, Height:=14) '5 x 2
ElseIf Rcolor(0) = 5 And Rcolor(1) = 3 And Rcolor(2) = "Black" Then
Set objImageBox = objSlide.Shapes.AddPicture(filename:=black1, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=680, Top:=286, Width:=15, Height:=14) '5 x 3
End If
End With
End With
SubExit:
On Error Resume Next
Exit Sub
SubError:
GeneralErrorHandler Err.Number, Err.Description, "Form_frmInstallationSnapShot", "Slide RatingGraphic"
GoTo SubExit
End Sub
I know the sub code is messy, but at my level of programming this was a victory for me.