LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Copy Excel chart to PPT that is already open

I have an Excel application where the user can view tables and charts
in Excel and have the option of exporting the table and pie chart into
a PowerPoint presentation. Here is my code that opens PPT and
launches a macro I have in PPT that copies the Excel pie chart and
table and pastes onto a new slide in the existing PPT file. This
works fine, except when I return to the Excel workbook and find other
tables I want to export into the PPT deck, this code opens a second
(read-only) version of the original. What is the code to simply copy
onto a PPT that is already open?

Sub OpenPPT()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation

Set PPApp = CreateObject("PowerPoint.Application")
PPApp.Visible = msoTrue

Set PPPres = PPApp.Presentations.Open("C:\data\TestPPT.ppt")

'******Runs macro in PPT that copies data from excel and pastes
onto PPT slides
PPApp.Run (PPPres.Name & "!AddPieChart")

End Sub


I tried replacing
Set PPApp = CreateObject("PowerPoint.Application")
with
Set PPApp = GetObject("PowerPoint.Application")

but that doesn't work.

Can anyone help me with this?

Thank you,

TB
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy chart formatting and chart templates in Excel 2007 Astelix Charts and Charting in Excel 4 March 4th 10 04:10 AM
From excel - open word doc and copy form field contents to excel c gnome88 Excel Programming 0 July 25th 05 11:45 PM
Why does excel create a copy of the worksheet i open Renee Excel Discussion (Misc queries) 4 March 2nd 05 06:17 PM
i can't open excel workbook if it has a chart in it! Aidan Excel Discussion (Misc queries) 2 February 2nd 05 09:37 AM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM


All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"