I created a macro in Excel that will spin a 3D chart. I copied the chart into PowerPoint, set up the code to run in PowerPoint when the slide is shown. The code runs, but I cannot get it to actually change what is shown on the screen. When the slide is in edit mode, the graph rotates. Any idea how to get the code to not just run (I can see the debug numbers showing up), but update the screen when in Presentation Mode? My code is:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub SpinTheChart()
RotateX = ActivePresentation.Slides(2).Shapes(2).Chart.ChartArea.Format _
.ThreeD.RotationX
Do While ActivePresentation.SlideShowWindow.View.CurrentShowPosition = 2
RotateX = RotateX + 7
If RotateX > 360 Then RotateX = RotateX - 360
ActivePresentation.Slides(2).Shapes(2).Chart.ChartArea.Format _
.ThreeD.RotationX = RotateX
DoEvents
Sleep 125
Debug.Print RotateX
Loop
End Sub
Sub OnSlideShowPageChange()
Dim i As Integer
i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
If i = 2 Then SpinTheChart
End Sub
UPDATE: I am still fighting this. It seems some recomendations say to update the currently displayed chart, you need to use, below the DoEvents:
SlideShowWindows(1).View.GotoSlide SlideSowWindows(1).View.CurrentShowPosition
but this does not work. It exits any code that is running. So the Do/Loop in the first function is exited and it does not go on to the second iteration.