Consulting

Results 1 to 2 of 2

Thread: How to get VBA Code to Apply to Only One PPT? (not all open PPTs)

  1. #1
    VBAX Regular
    Joined
    Feb 2022
    Posts
    37
    Location

    How to get VBA Code to Apply to Only One PPT? (not all open PPTs)

    I use this code below to prevent a PPT from scrolling to certain slides. However, it disrupts all other open PPTs. How to make it PPT specific?

    Sub OnSlideShowPageChange()    
    Dim oPres As Presentation
    Set oPres = ActivePresentation
    With oPres.SlideShowSettings
          .LoopUntilStopped = msoCTrue
          .AdvanceMode = ppSlideShowUseSlideTimings
          .ShowType = ppShowTypeWindow
          .Run
    End With
       
    Select Case oPres.SlideShowWindow.View.CurrentShowPosition
    'might be more flexible
    Case 1, 3, 4, 6, 8, 17
    With SlideShowWindows(1).View
         .GotoSlide (.LastSlideViewed.slideIndex), msoFalse
    End With
    Case Else
        Exit Sub
    End Select
    End Sub

  2. #2
    VBAX Regular
    Joined
    Feb 2022
    Posts
    37
    Location
    I figured out a fix (not sure it's the best fix) but...
    I changed the 14th line from
    "With SlideShowWindows(1).View"
    to
    "With oPres.SlideShowWindow.View"

    I'm not exactly sure why this original part at the top doesn't suffice in making it PPT specific:
    "
    Set oPres = Presentations("X.pptm")
    With oPres.SlideShowSettings"

    but it's working now : )

Posting Permissions

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