The_Rock
Board Regular
- Joined
- Jul 2, 2007
- Messages
- 174
Hi Guys
I have a code which copies from Excel to Powerpoint which works great.
I am not trying to tweak it with the following bit of code to preseve the source format.
What I then need to do is select the pasted chart and move it to the correct position. Its pasting as Chart 6 and so I am doing the following:
Now this is where it throws up a debug error "Item Chart 6 not found in the shapes collection".
If I click on Debug and continue to run the macro, it will run.
I need something in there that refreshes the powerpoint chart so it knows Chart 6 is there.
Hope you can help
This is the extract of the code:
I have a code which copies from Excel to Powerpoint which works great.
I am not trying to tweak it with the following bit of code to preseve the source format.
Code:
PPSlide.Application.CommandBars.ExecuteMso ("PasteSourceFormatting")
What I then need to do is select the pasted chart and move it to the correct position. Its pasting as Chart 6 and so I am doing the following:
Code:
PPApp.ActiveWindow.Selection.SlideRange.Shapes("Chart 6").Select
Now this is where it throws up a debug error "Item Chart 6 not found in the shapes collection".
If I click on Debug and continue to run the macro, it will run.
I need something in there that refreshes the powerpoint chart so it knows Chart 6 is there.
Hope you can help
This is the extract of the code:
Code:
IP.Activate
ActiveSheet.ChartObjects("Chart 3").Activate 'Select Chart
PPApp.ActiveWindow.ViewType = 1
ActiveChart.ChartArea.Copy
' Paste chart
PPSlide.Application.CommandBars.ExecuteMso ("PasteSourceFormatting")
PPApp.ActiveWindow.Selection.SlideRange.Shapes("Chart 6").Select
' Position pasted chart
PPApp.ActiveWindow.Selection.ShapeRange.Left = 0.75 * 28.3464567
PPApp.ActiveWindow.Selection.ShapeRange.Top = 2 * 28.3464567