Hi!
Im having a real headache of a problem with Excel > Powerpoint I really cannot get my head around.
I am creating a spreadsheet for someone. Basically on the spreadsheet is a 10 diffrent sets of data. Each set of data has a command button and when the command button is run this runs a macro. The macro selects 1 set of data, autofilters it to be all numbers higher than 0, then creates a graph in a new worksheet. The name of the worksheet is always the name of the graph.
This works perfectly.
The problem is, the user of the spreadsheet wants to be able to click another macro button which would Copy the Chart and automatically place it into a Powerpoint slide.
Each set of data would need a button to copy it into a powerpoint slide.
I have tried all kinds of macros to copy/paste into a Powerpoint object on a seperate worksheet but no matter what I do it does not seem to work!!!
Any ideas on how could get this function to work?![]()
![]()
Thanks!
Sawyer
To paste an excel chart into a powerpoint slide you have to copy and past it over as a picture. (Can be hard to do i hope you know VBA)
Sub PASTEINTOPOWERPOINT()
' Set a VBE reference to Microsoft PowerPoint Object Library
'(To set a reference to an application's type library click references on the tools menu. Select the check boxes for the applications with type libraries you want to reference.)
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
' Make sure a chart is selected
If ActiveChart Is Nothing Then
MsgBox "Please select a chart and try again.", vbExclamation, _
"No Chart Selected"
Else
' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide
' Reference active slide
Set PPSlide = PPPres.Slides _
(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
' Copy chart as a picture
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, _
Format:=xlPicture
' Paste chart
PPSlide.Shapes.Paste.Select
' Align pasted chart
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
' Clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End If
End Sub
Hope it works for you
JR
Versions
Mac OS X 'Leopard'
Mac MS Office Excel 2004
Windows XP
MS Excel 2002
MS Excel 2003
Ps
I got the above code from a friend, apparently he got it by searching from google
JR
Versions
Mac OS X 'Leopard'
Mac MS Office Excel 2004
Windows XP
MS Excel 2002
MS Excel 2003
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks