0
votes

I am a beginner at VBA.

I am designing a somewhat interactive Powerpoint presentation/s. I want to be able to have three separate Powerpoint presentations open that will link together. I have been trying (without success) to create, in VBA, code which will change the current displayed slide on one Powerpoint file by clicking a button in another. I can hyperlink to the set slide but this causes this slide to pop up on the same screen in which it is clicked, despite it being already open in another screen (I don't want this).

Thanks in advance for any help, Holly

2
Would help if you edit your question with your current code, thanks!BigBen
I haven't really got any yet, I tried numerous things but as I said, beginner! I have experience in using other languages but finding the VBA syntax really confusing. Any help would be appreciated...Holly Robinson

2 Answers

1
votes

VBA uses an object model that is a huge hierarchy of attributes and functions that represent the application. You can use this model to view and update attributes to get text, resize, and modify the application. You should look at some tutorials to get you started. When editing your code, you can press F2 to see and explore this object model. You can press F8 to run your code line by line (debug mode) and see what is happening. To your question, you can access the open presentations in the application.presentations object (https://docs.microsoft.com/en-us/office/vba/api/powerpoint.presentations). You could then use a presentation in that list and use the ActiveWindow.View.goToSlide function (https://docs.microsoft.com/en-us/office/vba/api/powerpoint.view.gotoslide). Here is a free tutorial that I've used in my VBA journey (https://www.tutorialspoint.com/vba/index.htm).

1
votes

PowerPoint has a Presentations collection that contains all currently open presentations. You can get a reference to any of them via Presentations("name") where "name" is the filename of the presentation, sans extension.

So ... assuming you've got three presentations open, a.pptx, b.pptx, c.pptx you can do something like this:

Sub SlideChange()
    With Presentations("c")
        .SlideShowWindow.View.GotoSlide (3)
    End With
End Sub

If you run the above in any of the presentations, it will change the slide show window displaying presentation c to the third slide.