De: "Peltier" Objet: Re: copying Excel onto PowerPoint Date : mardi 17 octobre 2000 01:21 Tony: I've attached a couple of macros, one copies a chart, the other a spreadsheet range, and both paste into PowerPoint. Both open PowerPoint, open a new PowerPoint presentation, copy and paste, then close the presentation and PowerPoint, all from Excel. But if PowerPoint is running, you'd use GetObject instead of CreateObject, you'd set PPPres=PPApp.Presentations("MyShow.ppt"), and you could select which slide to paste into. Fiddle around to get the syntax exactly right for your purposes (I put these together just to show myself I could figure out how). Good luck, - Jon ' start code ================================================== Sub ChartToPresentation() ' First you must set VBE reference to Microsoft PowerPoint 8.0 Object Library Dim ChartName As Variant Dim PPApp As PowerPoint.Application Dim PPPres As PowerPoint.Presentation Dim PPSlide As PowerPoint.Slide Dim PresentationFileName As Variant Dim CurrentTitle As Variant Dim SlideCount As Long set PPApp = CreateObject("Powerpoint.Application.8") set PPPres = PPApp.Presentations.Add CurrentTitle = "XlChartToPresentation" 'place a title name here PresentationFileName = PPApp.ActivePresentation.Path PresentationFileName = PresentationFileName & CurrentTitle & ".ppt" ChartName = "Chart1" 'chart sheet name here Charts(ChartName).Activate ActiveChart.CopyPicture xlScreen, xlBitmap, xlScreen SlideCount = PPPres.Slides.Count set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank) With PPSlide .Shapes.Paste End With SlideCount = SlideCount + 1 With PPPres .SaveAs PresentationFileName .Close End With PPApp.Quit set PPApp = Nothing set PPPres = Nothing End Sub ' ============================================================= Sub RangeToPresentation() ' First you must set VBE reference to Microsoft PowerPoint 8.0 Object Library Dim SheetName As Variant Dim PPApp As PowerPoint.Application Dim PPPres As PowerPoint.Presentation Dim PPSlide As PowerPoint.Slide Dim PresentationFileName As Variant Dim CurrentTitle As Variant Dim SlideCount As Long set PPApp = CreateObject("Powerpoint.Application.8") set PPPres = PPApp.Presentations.Add CurrentTitle = "XlRangeToPpt" 'place a title name here PresentationFileName = PPApp.ActivePresentation.Path PresentationFileName = PresentationFileName & CurrentTitle & ".ppt" SheetName = "Sheet1" 'chart sheet name here Sheets(SheetName).Range("MyRange").CopyPicture xlScreen, xlPicture SlideCount = PPPres.Slides.Count set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank) With PPSlide .Shapes.Paste End With SlideCount = SlideCount + 1 With PPPres .SaveAs PresentationFileName .Close End With PPApp.Quit set PPApp = Nothing set PPPres = Nothing End Sub ' end code ==================================================== tonybender@my-deja.com wrote: > > Bill, > > I have some applications that result in an Excel table, I have other > applications that are Excel charts. Either way I want the end-user to > be able to copy either a table or chart into PowerPoint. More > specifically I want to automate this copy process, so the end user runs > my excel application and decises to copy the resulting page directly > into PowerPoint at the puch of a command button. > > Can this be done? If so what is the VB code that copies an excel page > and pastes it into PowerPoint? > > Thanks > > In article , > Bill-Manville@msn.com wrote: > > > > In article <8s3jsr$nrc$1@nnrp1.deja.com>, wrote: > > > I'm trying to write a macro in Excel that copies an Excel worksheet > > > onto a PowerPoint chart. I'm not having any luck...can this be done? > > > If so what is the code. > > > > > Not sure what you mean, but I would make the chart in Excel and copy > it > > to a powerpoint slide. Is that what you want to do? > > > > Bill Manville > > MVP - Microsoft Excel, Oxford, England > > No email replies please - reply in newsgroup > > > > > > Sent via Deja.com http://www.deja.com/ > Before you buy.