Consulting

Results 1 to 16 of 16

Thread: Pause the program

  1. #1
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location

    Pause the program

    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)).IncrementRotation 30
                End If
                Next i1
                
                For j = LBound(shpArrColor) To UBound(shpArrColor)
                    ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RGB = 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.RGB = 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

  2. #2
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    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
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location
    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)).IncrementRotation 30
                End If
                Next i1
                
                For j = LBound(shpArrColor) To UBound(shpArrColor)
                    ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RGB = 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.RGB = 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

  4. #4
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    Attach a small presentation that we can play with
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location
    Dear Mr. Paul,

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

  6. #6
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    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

    Capture.JPG


    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)).IncrementRotation 30
                End If
                Next i1
                
                For j = LBound(shpArrColor) To UBound(shpArrColor)
                    ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RGB = 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.RGB = 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
    Attached Files Attached Files
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  7. #7
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location
    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

  8. #8
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    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
    Attached Files Attached Files
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  9. #9
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location
    Dear Paul,

    It is not working

  10. #10
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    Works for me

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

    You used my file from post 8?

    Capture.JPG

    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
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  11. #11
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location
    But when I am checking, 3-4 is not rotating and going back is not working. Directly it is going to 1-2 rotating

  12. #12
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    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)).IncrementRotation 30
                End If
                Next i1
                
                For j = LBound(shpArrColor) To UBound(shpArrColor)
                    ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RGB = 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.RGB = 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
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  13. #13
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location
    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)).IncrementRotation 30
                End If
                Next i1
                
                For j = LBound(shpArrColor) To UBound(shpArrColor)
                    ActivePresentation.Slides(3).Shapes.Range(shpArrColor(j)).Line.ForeColor.RGB = 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.RGB = 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

  14. #14
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    Good

    Glad it's working for you
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  15. #15
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    117
    Location
    Have you checked this

  16. #16
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    7,122
    Location
    Quote Originally Posted by elsuji View Post
    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
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •