lambuhere1
Registered User.
- Local time
- Today, 10:40
- Joined
- Nov 19, 2001
- Messages
- 28
Hi
I am a new bie to VBA. I wanted to write some code in PPT. What I am trying to do is to get the powerpoint open Excel application and open the workbook located in c:\ramp.xls and then copy the chart 1 into the present slide of the Powerpoint. The slide is blank. Whenever I use the following code, I get error. Runtime one. Can anyone tell me why ?
Sub xlchartpastespecial()
Dim xlapp As Object
Dim xlwrkbook As Object
Dim currslide As Long
Set xlapp = CreateObject("Excel.application")
Set xlwrkbook = xlapp.workbooks.Open("C:\Documents and Settings\janakira\My Documents\FSNL2_9H\spacer34_plots.xls")
xlworkbook.Charts("Chart1").chartobjects(1).CopyPicture
currslide = ActiveWindow.Selection.SlideRange.SlideNumber
ActivePresentation.Slides(currslide).Shapes.Paste
xlwrkbook.Close (False)
xlapp.Quit
Set xlapp = Nothing
Set xlwrkbook = Nothing
End Sub
By the way, Can anyone guide me with respect to any books on PPT VBA?
Thanks and regards
Ram P
I am a new bie to VBA. I wanted to write some code in PPT. What I am trying to do is to get the powerpoint open Excel application and open the workbook located in c:\ramp.xls and then copy the chart 1 into the present slide of the Powerpoint. The slide is blank. Whenever I use the following code, I get error. Runtime one. Can anyone tell me why ?
Sub xlchartpastespecial()
Dim xlapp As Object
Dim xlwrkbook As Object
Dim currslide As Long
Set xlapp = CreateObject("Excel.application")
Set xlwrkbook = xlapp.workbooks.Open("C:\Documents and Settings\janakira\My Documents\FSNL2_9H\spacer34_plots.xls")
xlworkbook.Charts("Chart1").chartobjects(1).CopyPicture
currslide = ActiveWindow.Selection.SlideRange.SlideNumber
ActivePresentation.Slides(currslide).Shapes.Paste
xlwrkbook.Close (False)
xlapp.Quit
Set xlapp = Nothing
Set xlwrkbook = Nothing
End Sub
By the way, Can anyone guide me with respect to any books on PPT VBA?
Thanks and regards
Ram P