akshayachand
01-10-2008, 03:20 AM
this is the code I am trying:
Sub try()
Dim Sh As Shape
Dim PPPres As Object
Dim objPPT As Object
Set objPPT = CreateObject("Powerpoint.Application")
objPPT.Visible = True
'Open the presentation you wish to copy to
Set PPPres = objPPT.Presentations.Open("D:\CopyTo.ppt")
'Set the shape you want to copy
Set Sh = ActiveSheet.Shapes("Chart 1")
'Copy the shape
Sh.Copy
'And paste it on the first slide
PPPres.Slides(1).Shapes("rectangle 6").Select
objPPT.ActiveWindow.View.Paste
PPPres.Slides(1).Shapes("rectangle 7").Select
objPPT.ActiveWindow.View.Paste
PPPres.Slides(1).Shapes("rectangle 8").Select
objPPT.ActiveWindow.View.Paste
PPPres.Slides(1).Shapes("rectangle 9").Select
objPPT.ActiveWindow.View.Paste
Set Sh = Nothing
Set objPPT = Nothing
Set PPPres = Nothing
End Sub
Guys, I want to understand how do we get the names of shapes in where we are pasting the graph. ( "rectangle" here)
This code I tried for pasting four charts as such format for slides is available in powerpoint. If I want to paste more than 4, say 5 or 6, graphs in a slide what should I do?
Sub try()
Dim Sh As Shape
Dim PPPres As Object
Dim objPPT As Object
Set objPPT = CreateObject("Powerpoint.Application")
objPPT.Visible = True
'Open the presentation you wish to copy to
Set PPPres = objPPT.Presentations.Open("D:\CopyTo.ppt")
'Set the shape you want to copy
Set Sh = ActiveSheet.Shapes("Chart 1")
'Copy the shape
Sh.Copy
'And paste it on the first slide
PPPres.Slides(1).Shapes("rectangle 6").Select
objPPT.ActiveWindow.View.Paste
PPPres.Slides(1).Shapes("rectangle 7").Select
objPPT.ActiveWindow.View.Paste
PPPres.Slides(1).Shapes("rectangle 8").Select
objPPT.ActiveWindow.View.Paste
PPPres.Slides(1).Shapes("rectangle 9").Select
objPPT.ActiveWindow.View.Paste
Set Sh = Nothing
Set objPPT = Nothing
Set PPPres = Nothing
End Sub
Guys, I want to understand how do we get the names of shapes in where we are pasting the graph. ( "rectangle" here)
This code I tried for pasting four charts as such format for slides is available in powerpoint. If I want to paste more than 4, say 5 or 6, graphs in a slide what should I do?