PDA

View Full Version : Update data for powerpoint show



hussong1555
03-29-2017, 12:41 PM
I am designing a KPI Portal where data from Excel is imbedded in a PowerPoint slideshow. Currently, all the data updates in the presentation file, but once I save it as a macro-enabled slideshow, the updates never occur. I have a Macro that from what I understand will update slides during the show, but it doesn't seem to work.

Here is my code:
Sub OnSlideShowPageChange()
Dim i As Integer
i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
If i <> 1 Then Exit Sub
' MsgBox "working"
Dim osld As Slide
Dim oshp As Shape
Dim opres As Presentation
Dim L As Long
On Error Resume Next
Set opres = objWindow.Parent
L = objWindow.View.CurrentShowPosition
If L < opres.Slides.Count Then
Set osld = objWindow.View.Slide
For Each oshp In objWindow.Parent.Slides(L + 1).Shapes
oshp.LinkFormat.Update
Next oshp
Else
For Each oshp In objWindow.Parent.Slides(1).Shapes
oshp.LinkFormat.Update
Next oshp
End If
End Sub


Any ideas what is going wrong?

Thanks

John Wilson
03-30-2017, 02:59 AM
OnSlideShowPageChange is very old code left over from PowerPoint 97. It is not reliable.

To improve things add an item from the control toolbox (eg. Command button - no code needed) and use the selection pane to set to invisible.

Save and try again.

You might want to explain EXACTLY what the code should do because it is a little confused.

hussong1555
03-30-2017, 07:04 AM
OnSlideShowPageChange is very old code left over from PowerPoint 97. It is not reliable.

To improve things add an item from the control toolbox (eg. Command button - no code needed) and use the selection pane to set to invisible.

Save and try again.

You might want to explain EXACTLY what the code should do because it is a little confused.




Hi John,

This is code I got from a Microsoft forum that I believe you responded to.

The code is supposed to update my slideshow. Ideally, it only needs to update once upon opening, but this is supposed to update every time I change slides I think.

Additionally, I am having an issue with charts updating. What is the best way it insert a chart from excel and have it change as the excel chart changes? current state is, while in the project file, as I add new data points in excel, the excel chart updates, but the chart I pasted into powerpoint will not .

John Wilson
03-30-2017, 10:19 PM
If you have linked items they should update when the file is opened anyway (no code needed) If you want the items to update while the show is running you would need code.


Sub OnSlideShowPageChange(SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = 1 Then
Dim osld As Slide
Dim oshp As Shape
On Error Resume Next
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
oshp.LinkFormat.Update
Next oshp
Next osld
End Sub

Don't forget the info above re. command button

hussong1555
04-06-2017, 01:43 PM
If you have linked items they should update when the file is opened anyway (no code needed) If you want the items to update while the show is running you would need code.


Sub OnSlideShowPageChange(SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = 1 Then
Dim osld As Slide
Dim oshp As Shape
On Error Resume Next
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
oshp.LinkFormat.Update
Next oshp
Next osld
End Sub

Don't forget the info above re. command button

Should the code be in a slide or in a module?

John Wilson
04-06-2017, 11:26 PM
Just in a standard module.