Hi all,
If got a litte issue:
I'm trying to write a macro that copies a range from Excel into an template Powerpoint Presentation.
I can copy the range, open the PPT and add a new slide in the run mode without any problems.
On the second page the title will be automatically changed --> works
and below on the same page I insert the copied range --> this works as well
Now I need to bring the inserted table in the right position and therefore, I'd like to set myShape = the inserted table
I use the following code (just for this action) and it works fine when I step it through manually but when I run the code I get the following error message: "Method 'Item' of 'Shap' failed"
and on the slide are just two objects:
Table 2 --> the inserted table
Title 1 --> the title
Does anyone has an idea how the code would work when I run it? Or do I have to define the Shape(Table) differently?
Best
SOFL
If got a litte issue:
I'm trying to write a macro that copies a range from Excel into an template Powerpoint Presentation.
I can copy the range, open the PPT and add a new slide in the run mode without any problems.
On the second page the title will be automatically changed --> works
and below on the same page I insert the copied range --> this works as well
Now I need to bring the inserted table in the right position and therefore, I'd like to set myShape = the inserted table
I use the following code (just for this action) and it works fine when I step it through manually but when I run the code I get the following error message: "Method 'Item' of 'Shap' failed"
Code:
'the title will be set
mySlide.Shapes(1).TextFrame.TextRange = "test slide"
PowerPointApp.CommandBars.ExecuteMso ("PasteSourceFormatting")
Debug.Print mySlide.Shapes.Count
Set myShape = mySlide.Shapes(2) 'here I get the error
myShape.Left = 20
myShape.Top = 120
myShape.Height = 350
myShape.Width = 680
and on the slide are just two objects:
Table 2 --> the inserted table
Title 1 --> the title
Does anyone has an idea how the code would work when I run it? Or do I have to define the Shape(Table) differently?
Best
SOFL