PDA

View Full Version : Pause the program



elsuji
05-06-2020, 10:05 AM
Dear Team,

I am new for this power point coding.

I had create code for pause the program and execute after 2 seconds in excel and it is working greate.
My excel code is

Sub MCI55_PUSH_BUTTON()Dim shp As Shape, shpArrOnOff, shpArrOnOff1, shpArrColor, i As Long, i1 As Long, j As Long, j1 As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Additional")
Set shp = ActiveSheet.Shapes("P-BUTTON")
shpArrColor = Array("RedClr32", "RedClr33", "RedClr37")
shpArrColor1 = Array("RedClr34", "RedClr35", "RedClr36", "RedClr37")
shpArrOnOff = Array("RedClr31")
shpArrOnOff1 = Array("RedClr34", "RedClr38", "YellowClr7", "BlueClr7")
With shp
If ActiveSheet.Shapes("MCCB-ON-OFF").TextFrame.Characters.Text = "ON" _
And ActiveSheet.Shapes("P-BUTTON").TextFrame.Characters.Text = "OFF" Then
.Fill.ForeColor.RGB = vbGreen
.TextFrame.Characters.Text = "ON"
.TextFrame.Characters.Font.Bold = True
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActiveSheet.Shapes(shpArrOnOff(i)).IncrementRotation 30


Next i

For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActiveSheet.Shapes("MCCB-ON-OFF").TextFrame.Characters.Text = "ON" _
And ActiveSheet.Shapes("P-BUTTON").TextFrame.Characters.Text = "ON" Then
ActiveSheet.Shapes(shpArrOnOff1(i1)).IncrementRotation 30
End If
Next i1

For j = LBound(shpArrColor) To UBound(shpArrColor)
ActiveSheet.Shapes(shpArrColor(j)).Line.ForeColor.RGB = vbRed
Next j
If ws.Shapes("P-BUTTON").TextFrame.Characters.Text = "ON" Then
ActiveSheet.Shapes("Group14").Line.ForeColor.RGB = vbYellow
ActiveSheet.Shapes("Group15").Line.ForeColor.RGB = vbBlue
End If

Call PauseIt
Application.Wait (Now() + TimeValue("0:00:01"))


For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActiveSheet.Shapes(shpArrOnOff(i)).IncrementRotation -30
Next i

For j = LBound(shpArrColor) To UBound(shpArrColor)
ActiveSheet.Shapes(shpArrColor(j)).Line.ForeColor.RGB = vbBlack
Next j
For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActiveSheet.Shapes(shpArrColor1(j1)).Line.ForeColor.RGB = vbRed
Next j1


End If
End With
End Sub
Sub PauseIt()
'Application.Wait (Now() + TimeValue("0:00:00"))
End Sub




The i modified the excel code as per power point. But pause condition is not working
My power point code is


Sub MCI55_PUSH_BUTTON()Dim shp As Shape, shpArrOnOff, shpArrOnOff1, shpArrColor, shpArrColor1, i As Long, i1 As Long, j As Long, j1 As Long




Set shp = ActivePresentation.Slides(3).Shapes("P-BUTTON")
shpArrColor = Array("RedClr32", "RedClr33", "RedClr37")
shpArrColor1 = Array("RedClr34", "RedClr35", "RedClr36", "RedClr37")
shpArrOnOff = Array("RedClr31")
shpArrOnOff1 = Array("RedClr34", "RedClr38", "YellowClr7", "BlueClr7")
With shp
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "OFF" Then
.Fill.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Text = "ON"
.TextFrame.TextRange.Font.Bold = True
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation 30


Next i

For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff1(i1)).IncrementRotati on 30
End If
Next i1

For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbRed
Next j
If ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes("Group14").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(3).Shapes("Group15").Line.ForeColor.RGB = vbBlue
End If


Call PauseIt
Application.WAIT (Now() + TimeValue("0:00:01"))


For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation -30
Next i


For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbBlack
Next j
For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor1(j1)).Line.ForeColor. RGB = vbRed
Next j1

End If
End With
End Sub
Sub PauseIt()
Application.WAIT (Now() + TimeValue("0:00:00"))
End Sub




when i am running above code i am getting "Method or Data member not found" error message.

Can any one help me to correct this issue

Paul_Hossler
05-06-2020, 04:41 PM
PP doesn't have a .Wait

Try using Sleep instead



Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

...
...
...

Sleep 1000 ' for a one second delay

elsuji
05-07-2020, 04:05 AM
I tried sleep function. But it is not working as per my requirement.

My requirement is

Fit it should execute the following


Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub MCI55_PUSH_BUTTON()Dim shp As Shape, shpArrOnOff, shpArrOnOff1, shpArrColor, shpArrColor1, i As Long, i1 As Long, j As Long, j1 As Long




Set shp = ActivePresentation.Slides(3).Shapes("P-BUTTON")
shpArrColor = Array("RedClr32", "RedClr33", "RedClr37")
shpArrColor1 = Array("RedClr34", "RedClr35", "RedClr36", "RedClr37")
shpArrOnOff = Array("RedClr31")
shpArrOnOff1 = Array("RedClr34", "RedClr38", "YellowClr7", "BlueClr7")
With shp
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "OFF" Then
.Fill.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Text = "ON"
.TextFrame.TextRange.Font.Bold = True
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation 30
Next i

For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff1(i1)).IncrementRotati on 30
End If
Next i1

For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbRed
Next j
If ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("1F1").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes("Group14").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(3).Shapes("Group15").Line.ForeColor.RGB = vbBlue
End If




Then it will wait for 2sec and after 2sec it should execute the following


Sleep 2000

For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation -30
Next i


For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbBlack
Next j
For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor1(j1)).Line.ForeColor. RGB = vbRed
Next j1


End If
End With
End Sub

Can you please check and confirm the code

Paul_Hossler
05-07-2020, 06:30 AM
Attach a small presentation that we can play with

elsuji
05-07-2020, 06:53 AM
Dear Mr. Paul,

I had attached my file here for your reference. For your easy understand i marked yellow border on my slide

Paul_Hossler
05-07-2020, 02:12 PM
1. The usual PP way to define a macro to run when clicking a shape is



Sub MCI55_PUSH_BUTTON(shp As Shape)

The clicked shape gets passed in the call

2. I made a small driver program to step through



Sub drv()
Call MCI55_PUSH_BUTTON(ActivePresentation.Slides(3).Shapes("P-BUTTON"))
End Sub




3. As written the red was = "ON" and = "OFF"

Stepping through the AND was false and nothing, including the Sleep, was never executed

Temporilarly changing

ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "OFF"


then the If/Then was executed, including the Sleep

26591




Sub MCI55_PUSH_BUTTON(shp As Shape)


Dim shpArrOnOff, shpArrOnOff1, shpArrColor, shpArrColor1, i As Long, i1 As Long, j As Long, j1 As Long


' Set shp = ActivePresentation.Slides(3).Shapes("P-BUTTON")

shpArrColor = Array("RedClr32", "RedClr33", "RedClr37")
shpArrColor1 = Array("RedClr34", "RedClr35", "RedClr36", "RedClr37")
shpArrOnOff = Array("RedClr31")
shpArrOnOff1 = Array("RedClr34", "RedClr38", "YellowClr7", "BlueClr7")

With shp
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "OFF" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "OFF" Then

.Fill.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Text = "ON"
.TextFrame.TextRange.Font.Bold = True

For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation 30
Next i

For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff1(i1)).IncrementRotati on 30
End If
Next i1

For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbRed
Next j
If ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("1F1").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes("Group14").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(3).Shapes("Group15").Line.ForeColor.RGB = vbBlue
End If

MsgBox "Before"

Sleep 2000

MsgBox "After"




For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation -30
Next i


For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbBlack
Next j
For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor1(j1)).Line.ForeColor. RGB = vbRed
Next j1


End If
End With
End Sub

elsuji
05-07-2020, 07:06 PM
Dear Paul,

I checked your code. It is working with Msgbox. If i removed Msgbox it is not working.

How to do this without Msgbox

Paul_Hossler
05-07-2020, 07:34 PM
Try replacing the 3 lines with just these

I changed it to 10 seconds to test, and the hour glass seems to 'wait' for 10 seconds



DoEvents
Sleep 10000


You can see the 3-4 rotate, but then it switches back so I assume that there's more code

elsuji
05-08-2020, 07:47 AM
Dear Paul,

It is not working

Paul_Hossler
05-08-2020, 08:28 AM
Works for me

"Not working" doesn't provide much to look at

You used my file from post 8?

26603

Load it
Slide show
Slide 3 - click the Red OFF
3-4 rotates
Hourglass for 10 seconds
3-4 goes back

I didn't look at the rest of your logic

elsuji
05-08-2020, 08:53 AM
But when I am checking, 3-4 is not rotating and going back is not working. Directly it is going to 1-2 rotating

Paul_Hossler
05-08-2020, 04:07 PM
Maybe your logic in this and the other macros is wrong

Make P-BUTTON text = OFF and single step (F8) through the drv macro


This rotates 3-4 back to original position



For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation -30
Next i






Sub drv()
Call MCI55_PUSH_BUTTON(ActivePresentation.Slides(3).Shapes("P-BUTTON"))
End Sub




Sub MCI55_PUSH_BUTTON(shp As Shape)


Dim shpArrOnOff, shpArrOnOff1, shpArrColor, shpArrColor1, i As Long, i1 As Long, j As Long, j1 As Long


' Set shp = ActivePresentation.Slides(3).Shapes("P-BUTTON")

shpArrColor = Array("RedClr32", "RedClr33", "RedClr37")
shpArrColor1 = Array("RedClr34", "RedClr35", "RedClr36", "RedClr37")
shpArrOnOff = Array("RedClr31")
shpArrOnOff1 = Array("RedClr34", "RedClr38", "YellowClr7", "BlueClr7")

With shp
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "OFF" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "OFF" Then

.Fill.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Text = "ON"
.TextFrame.TextRange.Font.Bold = True

For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation 30
Next i

For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff1(i1)).IncrementRotati on 30
End If
Next i1

For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbRed
Next j
If ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("1F1").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes("Group14").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(3).Shapes("Group15").Line.ForeColor.RGB = vbBlue
End If




DoEvents
Sleep 10000

For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation -30
Next i


For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbBlack
Next j

For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor1(j1)).Line.ForeColor. RGB = vbRed
Next j1


End If
End With
End Sub

elsuji
05-09-2020, 05:09 AM
Dear Paul,

I had modified the code my self. It is working now.


Sub MCI55_PUSH_BUTTON()Dim shp As Shape, shpArrOnOff, shpArrOnOff1, shpArrColor, shpArrColor1, i As Long, i1 As Long, j As Long, j1 As Long




Set shp = ActivePresentation.Slides(3).Shapes("P-BUTTON")
shpArrColor = Array("RedClr32", "RedClr33", "RedClr37")
shpArrColor1 = Array("RedClr34", "RedClr35", "RedClr36", "RedClr37")
shpArrOnOff = Array("RedClr31")
shpArrOnOff1 = Array("RedClr34", "RedClr38", "YellowClr7", "BlueClr7")
With shp
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "OFF" Then
.Fill.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Text = "ON"
.TextFrame.TextRange.Font.Bold = True
For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation 30
Next i

For i1 = LBound(shpArrOnOff1) To UBound(shpArrOnOff1)
If ActivePresentation.Slides(3).Shapes("MCCB-ON-OFF").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff1(i1)).IncrementRotati on 30
End If
Next i1

For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbRed
Next j
If ActivePresentation.Slides(3).Shapes("P-BUTTON").TextFrame.TextRange.Text = "ON" _
And ActivePresentation.Slides(3).Shapes("1F1").TextFrame.TextRange.Text = "ON" Then
ActivePresentation.Slides(3).Shapes("Group14").Line.ForeColor.RGB = vbYellow
ActivePresentation.Slides(3).Shapes("Group15").Line.ForeColor.RGB = vbBlue
End If


Call SleepIt
DoEvents
Sleep 500


For i = LBound(shpArrOnOff) To UBound(shpArrOnOff)
ActivePresentation.Slides(3).Shapes.Range(shpArrOnOff(i)).IncrementRotation -30
Next i


For j = LBound(shpArrColor) To UBound(shpArrColor)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RG B = vbBlack
Next j
For j1 = LBound(shpArrColor1) To UBound(shpArrColor1)
ActivePresentation.Slides(3).Shapes.Range(shpArrColor1(j1)).Line.ForeColor. RGB = vbRed
Next j1


End If
End With
End Sub


Sub SleepIt()
Sleep 1000
End Sub

Paul_Hossler
05-09-2020, 08:23 AM
Good

Glad it's working for you

elsuji
05-09-2020, 08:31 AM
Have you checked this

Paul_Hossler
05-09-2020, 09:18 AM
Have you checked this

No. Why?

You said it was working for you

It's not the way I would do it, but just so it works for you

elsuji
12-22-2020, 11:15 AM
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.RG B = 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)).IncrementRotati on -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)).IncrementRotati on -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.RG B = 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)).IncrementRotati on 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)).IncrementRotati on -45
Next i1

For i2 = LBound(shpArrOnOff2) To UBound(shpArrOnOff2)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).IncrementRotati on 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.RG B = 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)).IncrementRotati on -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)).IncrementRotati on -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.RG B = 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)).IncrementRotati on 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)).IncrementRotati on -45
Next i1

For i2 = LBound(shpArrOnOff2) To UBound(shpArrOnOff2)
ActivePresentation.Slides(5).Shapes.Range(shpArrOnOff2(i2)).IncrementRotati on 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

Paul_Hossler
12-22-2020, 11:39 AM
It's easier to check if you can attach a presentation with the macros and shapes and slides and etc.

elsuji
12-22-2020, 12:27 PM
Dear Paul,

Attached my file here. Go to slide no 5

elsuji
01-06-2021, 11:23 AM
Dear Paul,

Please reply me for above my problem

Paul_Hossler
01-10-2021, 08:30 AM
Sorry

I was not able to figure it out

Maybe someone else here can help