PDA

View Full Version : Multiple presentations, multiple Excel links



Feastie
09-16-2015, 03:12 AM
First time on VBA Express, so 'Hi' to everyone.

I am running 6 powerpoint presentations on one PC that relate to different customer lines in my business, each one showing the stats relevant to that line and displayed both on a local monitor and a large screen above the line (6 of each!).
All of the presentations link to just one Excel file that updates around every five minutes.
In order to run all 6 presentations at the same time and to not lose focus, I have them set to 'Browsed by an individual (window)' and they are looping continuously.
My problem is, the only presentation to actually keep updating is the currently selected show.
I'm sure I can throw the focus to the next presentation after, for example, reaching slide 1 and updating links, but I wondered if there was something easier I could do.
Any help would be very much appreciated. The code I'm currently using is below:-


Sub OnSlideShowPageChange()
Dim i As Integer
i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
If i <> 1 Then Exit Sub
ActivePresentation.UpdateLinks

End Sub

Thanks, Feastie.

Feastie
09-17-2015, 02:26 AM
If it makes things any easier, I want to have code in one presentation that, when it reaches slide 1 it updates links in all open presentations.
Assuming I have two presentations, A and B, the code I would like is along these lines.

When presentation A reaches slide 1
UpdateLinks presentation A and UpdateLinks presentation B

Can I be this specific? - Thanks.

John Wilson
09-20-2015, 12:24 PM
This is off the top of my head but might give a start


Sub OnSlideShowPageChange()
Dim i As Integer
Dim opres As Presentation
For Each opres In Application.Presentations
i = opres.SlideShowWindow.View.CurrentShowPosition
If i = 1 Then
opres.UpdateLinks
End If
Next opres
End Sub

Feastie
09-21-2015, 02:06 AM
Thanks John,

this seems to work fine on testing with 2 presentations, I'll give it a whirl with all 6.

Not bad for 'off the top of your head'.

Feastie.

John Wilson
09-22-2015, 01:11 PM
And so you know OnSlideShowPageChange is unsupported legacy code. It is not totally reliable. Often if you save and reopen it wont fire the event. Best proctice - add any item from the control toolbox and set it's visibility to false. I know that sounds like witchcraft but it helps.

ajmalk
10-22-2015, 11:39 PM
Thank you so much for this information guys