VBA Error

vmoore845

New Member
Joined
Oct 5, 2020
Messages
14
Office Version
  1. 2010
Platform
  1. Windows
I use Sage Intelligence for all reports - I have created charts in 33 worksheets of a workbook and want to export to PowerPoint - I created the VBA (I copied it from someone else) I used it and worked great. I had to update the Excel file so after updating ran the Sage Intelligence reports (generates the Excel file); try to run the Script and am getting the following error:

1601943734055.png


Below is the Script:

Sub ExportChartsToPowerPoint_SingleWorkbook()

'Declare PowerPoint Variables
Dim PPTApp As Powerpoint.Application
Dim PPTPres As Powerpoint.Presentation
Dim PPTSlide As Powerpoint.Slide
Dim SldIndex As Integer

'Declare Excel Object Variables
Dim Chrt As ChartObject
Dim WrkSht As Worksheet

'Create a new instance of PowerPoint
Set PPTApp = New Powerpoint.Application
PPTApp.Visible = True

'Create a new Presentation within the Application
Set PPTPres = PPTApp.Presentations.Add

'Create an index handler for slide creation
SldIndex = 1

'Loop through all of the worksheets in the ACTIVEWORKBOOK
For Each WrkSht In Worksheets

'Loop through all the Chart Objects on the ACTIVESHEET
For Each Chrt In WrkSht.ChartObjects

'Copy the chart
Chrt.Copy

'Create a new slide, set the layout to blank, and paste chart on the slide
Set PPTSlide = PPTPres.Slides.Add(SldIndex, ppLayoutBlank)
PPTSlide.Shapes.Paste

'Increment our slide index
SldIndex = SldIndex + 1

Next Chrt

Next WrkSht

End Sub

Can someone help me figure out what is wrong?

Thank you!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Do you have a reference to the PowerPoint Object Library in this VB project?

What is highlighted when you get the error?
 
Upvote 0
Thank you, that was my problem, I had to select PowerPoint in the Reference tools.
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,652
Members
448,975
Latest member
sweeberry

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top