Reputation: 127
This one has me pretty confused. I have written a code that creates a pivot table in excel. It then creates a new PowerPoint and adjusts the formatting. Finally, I am hoping to take the pivot table from excel, copy it, and paste it into the PowerPoint file. I want to be able to edit it so a bitmap, picture, GIF, etc. will not work.
Everything works fine until I paste the pivot table into excel. This pastes a picture into the PowerPoint, no problem:
pt.TableRange1.Copy
newPPT.ActivePresentation.Slides(1).Shapes.PasteSpecial (ppPasteMetafilePicture)
where pt is the pivot table, and newPPT is the PowerPoint.Application
This, however, does not work.
pt.TableRange1.Copy
newPPT.ActivePresentation.Slides(1).Shapes.PasteSpecial (ppPasteHTML)
Nothing pastes at all. I have tried zooming out, moving all objects around because maybe it pasted behind everything but no luck. Any idea why this is happening?
Also, when I paste from the clipboard after the code has run, without re-copying the pivot table, it pastes no problem.
Thanks
Upvotes: 0
Views: 740
Reputation: 127
This worked:
pt.TableRange1.Copy
newPPT.ActiveWindow.View.PasteSpecial ppPasteHTML
I don't know why it doesn't using the shapes paste special, but this is a workaround.
Anyone know why this is the case?
Upvotes: 1