DEV Community

Oscar Sun(孫守真字任真)
Oscar Sun(孫守真字任真)

Posted on

Answer: My VBA code does not recognize the shape it pasted in excel. However, if I run the code after not ...

Try to change these:

1 PP.CommandBars.ExecuteMso "PasteSourceFormatting" 'Paste

to

PPSlide.Shapes.Paste


Set PPShape = PPSlide.Shapes(7)

to

Set PPShape = PPSlide.Shapes(PPSlide.Shapes.count)

so like this:

...
        expRng.Copy 'Set range from excel
        'PP.CommandBars.ExecuteMso "PasteSourceFormatting" 'Paste
        
        Set PPSlide = PPPres.Slides(vSlide_No)
        'Set PPShape = PPSlide.Shapes(7) 'Set shape to be altered
        PPSlide.Shapes.Paste
        
        Set PPShape = PPSlide.Shapes(PPSlide.Shapes.Count)
        
        With

Top comments (0)