Guest_imported
New member
- Jan 1, 1970
- 0
I have an Excel file with several charts in it. Let's say the file name is test.xls. I also have an empty PowerPoint file test.ppt that should be created on the test.xls file basis. I need to write the code in Excel file to open PowerPoint file, create a new slide in it and then paste a link from Excel file. The purpose is to automate the presentation creation in case if I have 100 charts in Excel file. Here is the code I wrote:
Sub CreatePresentation()
Dim PowerPointObject As Object
'Create a PowerPoint Object
Set PowerPointObject = CreateObject("PowerPoint.Application"
'Open PowerPoint object
PowerPointObject.Visible = True
'Open the file in PowerPoint
PowerPointObject.Presentations.Open FileName:="D:/test.ppt"
ActiveWorkbook.Worksheets("Sheet1".Activate
ActiveSheet.ChartObjects("Chart 1".Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
'HERE I need the code to add the slide to the presentation and paste a link from Excel
PowerPointObject.Quit
Set PowerPointObject = Nothing
End Sub
Could anybody help me with this issue? Thank you.
Sub CreatePresentation()
Dim PowerPointObject As Object
'Create a PowerPoint Object
Set PowerPointObject = CreateObject("PowerPoint.Application"
'Open PowerPoint object
PowerPointObject.Visible = True
'Open the file in PowerPoint
PowerPointObject.Presentations.Open FileName:="D:/test.ppt"
ActiveWorkbook.Worksheets("Sheet1".Activate
ActiveSheet.ChartObjects("Chart 1".Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
'HERE I need the code to add the slide to the presentation and paste a link from Excel
PowerPointObject.Quit
Set PowerPointObject = Nothing
End Sub
Could anybody help me with this issue? Thank you.