Share via

VBA PowerPoint Chart

Anonymous
2016-02-04T20:53:18+00:00

My question is whether it is possible to write VBA code in PowerPoint to cause a pie chart to cycle through several years of data. I have done it in Excel with a button, but cannot find a way to either copy that button and chart or create the same effect in my presentation. If I copy the chart from Excel to PPT, I can control it from Excel, but not while in presentation mode.

Below is the code I used in Excel:

Private Sub CommandButton1_Click()

Dim PauseTime, Start

Dim i As Integer

i = 1

Do While i <= 8

    Sheet13.Cells.Range("B1").Value = i    <----- I know this will not work in my PPT file.

    i = i + 1

    PauseTime = 0.6 ' Set duration.

    Start = Timer   ' Set start time.

    Do While Timer < Start + PauseTime ' Start + PauseTime

        DoEvents    ' Yield to other processes.

    Loop

Loop

End Sub

I've also inserted a scroll bar for more manual manipulation. I would very much appreciate any and all help with this!

Thanks

Liz

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-02-05T08:00:07+00:00

You could probably adapt the code but it would be a lot easier (and look better) if you create a custom show with slides showing each year. The show could be set to loop if you wish.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful