none
Updating Chart in Powerpoint 2016 via VBA while in Presenter Mode RRS feed

  • Question

  • Hi folks,

    I have a Powerpoint presentation with a single slide, containing a TreeMap chart and a button. I want to show the slide in presenter mode, click on the button, and have the chart update. What happens however, is that the chart is updated in the Powerpoint editor, but the chart shown in presenter mode is not changed. Does anybody have any idea how to change this? Here's the button's code:

    Private Sub CommandButton1_Click()
        Dim myArray(5) As Integer
        For i = 0 To 4
            myArray(i) = Int((10 * Rnd) + 1)
        Next
        
        With ActivePresentation.Slides(1).Shapes(1).Chart
            .ChartData.Activate
            .ChartData.Workbook.Worksheets("Tabelle1").Range("B2:B" & UBound(myArray) + 1) = Excel.WorksheetFunction.Transpose(myArray)
            .Refresh
        End With
        
    End Sub

    Pug McThug


    • Edited by Pug McThug Thursday, June 22, 2017 6:25 AM
    Wednesday, June 21, 2017 7:59 AM

All replies

  • Hi Pug McThug,

    How do you use Presenter Mode? I enter Presenter Mode by right clicking on normal Slide Show view and select show presenter view option. However, in my test, button click event could not trigger on this presenter view(I only have one screen, so I could only see presenter view).  Would the chart data refresh on audience views when you go to next slide and go back? If it works, we could use SlideShowWindows(1).View.GotoSlide to go to current slide to refresh data. Here is the example. 

    index =SlideShowWindows(1).View.CurrentShowPosition
    SlideShowWindows(1).View.GotoSlide index

    Best Regards,

    Terry

    Thursday, June 22, 2017 10:21 AM
  • Hi Terry,

    I have two monitors, and I've configured PowerPoint to automatically enter "Presenter Mode" whenever I start presenting. The chart data shown to the audience is not changed when I proceed to the next slide and then go back. I get the impression that no refresh event is sent to the audience view when the chartdata is updated.

    Is there anything I can provide you that would help reproduce the error?

    Many thanks,

    Pug McThug

    Thursday, June 29, 2017 6:32 AM
  • Hi Pug McThug,

    I only found a workaround in normal slide show mode because I only one monitor, hope it could work in presenter mode. I tried to edit chart data when ppt is in slide show mode, I found that some chart, such as Column chart, would update in slide show interface, but some chart, such as treemap chart, won't update in slide show interface. Besides, I found all charts would disappear when I delete it in the Power Point editor, so I have an idea that we could update the chart and then copy it to the same location as the chart and then delete original chart. It works in normal slide show mode. Here is the code

    Private Sub CommandButton1_Click()
    
       With ActivePresentation.Slides(1).Shapes(2).Chart
    
            .ChartData.Activate
    
            .ChartData.Workbook.Worksheets("Sheet1").Range("d2") = 222
    
            .ChartData.Workbook.Close
    
       End With
    
       Dim SHP1 As Shape
    
       Dim SHP2 As Shape
    
       Set SHP1 = ActivePresentation.Slides(1).Shapes(2)
    
       SHP1.Copy
    
       ActivePresentation.Slides(1).Shapes.Paste
    
       Set SHP2 = ActivePresentation.Slides(1).Shapes(3)
    
       SHP2.Top = SHP1.Top
    
       SHP2.Left = SHP1.Left
    
       SHP1.Delete
    
    End Sub

    Best Regards,

    Terry

    Tuesday, July 4, 2017 3:18 AM