Dear Paul,
I created code for rotating shape once my condition is meet.
my code is
Sub MIXER_6K1_ON_OFF_SD()Dim shp As Shape, shpArrColor, shpArrColor1, shpArrOnOff, ShpArrRot, shpArrOnOff1, shpArrOnOff2, _
i As Long, i1 As Long, i2 As Long, j As Long, j1 As Long, j2 As Long, x As Long
Set shp = ActivePresentation.Slides(5).Shapes("MIXER ON/OFF")
shpArrOnOff = Array("Orangeclr17", "RedClr7", "YellowClr7", "BlueClr7", "RedClr28")
shpArrOnOff1 = Array("RedClr50", "YellowClr50", "BlueClr50")
shpArrOnOff2 = Array("RedClr10", "YellowClr10", "BlueClr10")
shpArrColor = Array("Group7", "Group8", "Group9", "Group10", "Group11", "Group12", "Group16", "Group17", "Group18", _
"Group19", "Group20", "Group21", "Group22", "Group23", "Group24")
shpArrColor1 = Array("Oval11", "Oval12")
ShpArrRot = Array("Curved Down Arrow 253")
With shp
If .TextFrame.TextRange.Text = "ON" Then
.Fill.ForeColor.RGB = vbRed
.TextFrame.TextRange.Text = "OFF"
.TextFrame.TextRange.Font.Bold = True
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff(i)).IncrementRotation -45
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff(i)).Line.ForeColor.RGB = vbBlack
Next i
For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(5).Shapes("Group19").Line.ForeColor.RGB = vbRed Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff1(i1)).IncrementRotation -45
End If
Next i1
For i2 = LBound(shpArrOnOff2) To UBound(shpArrOnOff2)
If ActivePresentation.Slides(5).Shapes("Group20").Line.ForeColor.RGB = vbRed Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).IncrementRotation -45
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).Line.ForeColor.RGB = vbBlack
End If
Next i2
For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(5).Shapes.Range(shpArrColor(j)).Line.ForeColor.RGB = vbBlack
Next j
For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActivePresentation.Slides(5).Shapes(shpArrColor1(j1)).Line.ForeColor.RGB = vbBlack
ActivePresentation.Slides(5).Shapes(shpArrColor1(j1)).Fill.ForeColor.RGB = vbBlack
Next j1
ActivePresentation.Slides(5).Shapes("RedClr19").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr20").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval14").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval14").Fill.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval13").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval13").Fill.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr18").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Curved Down Arrow 253").Fill.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr34").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr35").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr36").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr38").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr37").Line.ForeColor.RGB = RGB(191, 191, 191)
Else
If ActivePresentation.Slides(5).Shapes("6Q1").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("6F2").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("INPUT_ON_OFF").TextFrame.TextRange.Text = "ON" Then
.Fill.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Text = "ON"
.TextFrame.TextRange.Font.Bold = True
End If
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes("Oval11").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval11").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Group17").Line.ForeColor.RGB = RGB(255, 102, 0)
ActivePresentation.Slides(5).Shapes("RedClr19").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr20").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group18").Line.ForeColor.RGB = vbRed
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("INPUT_ON_OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff(i)).IncrementRotation 45
End If
Next i
For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("INPUT_ON_OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff1(i1)).IncrementRotation 45
End If
Next i1
ActivePresentation.Slides(5).Shapes("Group7").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group8").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("Group9").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group16").Line.ForeColor.RGB = RGB(255, 102, 0)
ActivePresentation.Slides(5).Shapes("Oval14").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval14").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval13").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval13").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("RedClr28").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr7").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("YellowClr7").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("BlueClr7").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("RedClr18").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Orangeclr17").Line.ForeColor.RGB = RGB(255, 102, 0)
ActivePresentation.Slides(5).Shapes("Oval12").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval12").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Group21").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr34").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr35").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr36").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr38").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr37").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Group19").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Curved Down Arrow 253").Fill.ForeColor.RGB = vbGreen
End If
' Minimum & maximum angles in degrees
Const MinAngle& = 0, MaxAngle& = 360
' Define the rotation ratio from 0 up to 1
Dim phi&, Ratio#, t!
' Rotate shape
With ActivePresentation.Slides(5).Shapes(ShpArrRot(x))
Ratio = 0
Do
' Rotate clockwise
Ratio = Ratio + 0.02
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "OFF" Then Exit Do
' Calc the rotation angle in degrees
phi = (MinAngle + (MaxAngle - MinAngle) * Ratio) Mod 360
Debug.Print "phi = "; phi
' Rotate shape
.Rotation = phi
' Make pause
t = Timer + 0.01: While Timer < t: DoEvents: Wend
ContinueDo:
Loop 'While True
End With
Dim WAIT As Double
WAIT = Timer
While Timer < WAIT + 5
DoEvents 'do nothing
Wend
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes("RedClr36").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr38").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr37").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group20").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group19").Line.ForeColor.RGB = vbBlack
For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff1(i1)).IncrementRotation -45
Next i1
For i2 = LBound(shpArrOnOff2) To UBound(shpArrOnOff2)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).IncrementRotation 45
Next i2
ActivePresentation.Slides(5).Shapes("RedClr10").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("YellowClr10").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("BlueClr10").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group12").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group22").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group11").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("Group23").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("Group10").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group24").Line.ForeColor.RGB = vbRed
End If
End If
End With
End Sub
this code is running my loop command
Sub MIXER_6K1_ON_OFF_SD()Dim shp As Shape, shpArrColor, shpArrColor1, shpArrOnOff, ShpArrRot, shpArrOnOff1, shpArrOnOff2, _
i As Long, i1 As Long, i2 As Long, j As Long, j1 As Long, j2 As Long, x As Long
Set shp = ActivePresentation.Slides(5).Shapes("MIXER ON/OFF")
shpArrOnOff = Array("Orangeclr17", "RedClr7", "YellowClr7", "BlueClr7", "RedClr28")
shpArrOnOff1 = Array("RedClr50", "YellowClr50", "BlueClr50")
shpArrOnOff2 = Array("RedClr10", "YellowClr10", "BlueClr10")
shpArrColor = Array("Group7", "Group8", "Group9", "Group10", "Group11", "Group12", "Group16", "Group17", "Group18", _
"Group19", "Group20", "Group21", "Group22", "Group23", "Group24")
shpArrColor1 = Array("Oval11", "Oval12")
ShpArrRot = Array("Curved Down Arrow 253")
With shp
If .TextFrame.TextRange.Text = "ON" Then
.Fill.ForeColor.RGB = vbRed
.TextFrame.TextRange.Text = "OFF"
.TextFrame.TextRange.Font.Bold = True
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff(i)).IncrementRotation -45
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff(i)).Line.ForeColor.RGB = vbBlack
Next i
For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(5).Shapes("Group19").Line.ForeColor.RGB = vbRed Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff1(i1)).IncrementRotation -45
End If
Next i1
For i2 = LBound(shpArrOnOff2) To UBound(shpArrOnOff2)
If ActivePresentation.Slides(5).Shapes("Group20").Line.ForeColor.RGB = vbRed Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).IncrementRotation -45
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).Line.ForeColor.RGB = vbBlack
End If
Next i2
For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(5).Shapes.Range(shpArrColor(j)).Line.ForeColor.RGB = vbBlack
Next j
For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActivePresentation.Slides(5).Shapes(shpArrColor1(j1)).Line.ForeColor.RGB = vbBlack
ActivePresentation.Slides(5).Shapes(shpArrColor1(j1)).Fill.ForeColor.RGB = vbBlack
Next j1
ActivePresentation.Slides(5).Shapes("RedClr19").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr20").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval14").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval14").Fill.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval13").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Oval13").Fill.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr18").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Curved Down Arrow 253").Fill.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr34").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr35").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr36").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr38").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr37").Line.ForeColor.RGB = RGB(191, 191, 191)
Else
If ActivePresentation.Slides(5).Shapes("6Q1").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("6F2").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("INPUT_ON_OFF").TextFrame.TextRange.Text = "ON" Then
.Fill.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Text = "ON"
.TextFrame.TextRange.Font.Bold = True
End If
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes("Oval11").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval11").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Group17").Line.ForeColor.RGB = RGB(255, 102, 0)
ActivePresentation.Slides(5).Shapes("RedClr19").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr20").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group18").Line.ForeColor.RGB = vbRed
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("INPUT_ON_OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff(i)).IncrementRotation 45
End If
Next i
For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(5).Shapes("INPUT_ON_OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff1(i1)).IncrementRotation 45
End If
Next i1
ActivePresentation.Slides(5).Shapes("Group7").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group8").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("Group9").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group16").Line.ForeColor.RGB = RGB(255, 102, 0)
ActivePresentation.Slides(5).Shapes("Oval14").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval14").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval13").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval13").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("RedClr28").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr7").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("YellowClr7").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("BlueClr7").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("RedClr18").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Orangeclr17").Line.ForeColor.RGB = RGB(255, 102, 0)
ActivePresentation.Slides(5).Shapes("Oval12").Line.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Oval12").Fill.ForeColor.RGB = vbGreen
ActivePresentation.Slides(5).Shapes("Group21").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr34").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr35").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr36").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr38").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("RedClr37").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("Group19").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Curved Down Arrow 253").Fill.ForeColor.RGB = vbGreen
End If
' Minimum & maximum angles in degrees
Const MinAngle& = 0, MaxAngle& = 360
' Define the rotation ratio from 0 up to 1
Dim phi&, Ratio#, t!
' Rotate shape
With ActivePresentation.Slides(5).Shapes(ShpArrRot(x))
Ratio = 0
Do
' Rotate clockwise
Ratio = Ratio + 0.02
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "OFF" Then Exit Do
' Calc the rotation angle in degrees
phi = (MinAngle + (MaxAngle - MinAngle) * Ratio) Mod 360
Debug.Print "phi = "; phi
' Rotate shape
.Rotation = phi
' Make pause
t = Timer + 0.01: While Timer < t: DoEvents: Wend
ContinueDo:
Loop 'While True
End With
Once it is reached after 5 second it should run the below command
Dim WAIT As DoubleWAIT = Timer
While Timer < WAIT + 5
DoEvents 'do nothing
Wend
If ActivePresentation.Slides(5).Shapes("MIXER ON/OFF").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(5).Shapes("RedClr36").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr38").Line.ForeColor.RGB = RGB(191, 191, 191)
ActivePresentation.Slides(5).Shapes("RedClr37").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group20").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group19").Line.ForeColor.RGB = vbBlack
For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff1(i1)).IncrementRotation -45
Next i1
For i2 = LBound(shpArrOnOff2) To UBound(shpArrOnOff2)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).IncrementRotation 45
Next i2
ActivePresentation.Slides(5).Shapes("RedClr10").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("YellowClr10").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("BlueClr10").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group12").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group22").Line.ForeColor.RGB = vbBlue
ActivePresentation.Slides(5).Shapes("Group11").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("Group23").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(5).Shapes("Group10").Line.ForeColor.RGB = vbRed
ActivePresentation.Slides(5).Shapes("Group24").Line.ForeColor.RGB = vbRed
End If
But is not working. means after loop it is not going to next command.
Can you please help me how to do this