
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Macro to Copy & Paste table into Powerpoint using paste special
Hello,
I'm hoping someone has experience pasting tables into Powerpoint using paste special. I've had success using CopyToBitmapToClipboard using the following code:
ActiveDocument.GetSheetObject("CH418").CopyBitmapToClipboard
PPSlide.Shapes.Paste.Select
I would like to paste in an editable table instead of an image and I thought something like this code would work:
ActiveDocument.GetSheetObject("CH418").CopyTableToClipboard True
PPSlide.Shapes.PasteSpecial(PasteHTML).Select
However, I get the following error:
Shapes.PasteSpecial : Invalid request. Clipboard is empty or contains data which may not be pasted here.
I confirmed that the Clipboard was not empty by manually pasting from it into Powerpoint. I also tried PasteDefault instead of PasteHTML.
The PasteSpecial works with CopyBitmapToClipboard. The example below worked so I think some form of PasteSpecial should work for straight tables:
ActiveDocument.GetSheetObject("CH418").CopyBitmapToClipboard
PPSlide.Shapes.PasteSpecial(PasteEnhancedMetafile).Select
If anyone has any insights, it would be greatly appreciated. I am using version 10.
thanx
Grant
- « Previous Replies
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanx to all that replied. based on what you provided and some additional research I put together a tool that others might find useful or at least a starting point for others in making simple PowerPoints from QlikView. I created a PowerPoint macro.
The macro basically builds the QlikView VB Script to copy QV objects to the clipboard and paste them into a PowerPoint presentation.
Basic Instructions:
1) add the number of blank slides required for the QV PowerPoint presentation (after the current blank slide)
2) add rectangles to those slides representing the size and position where the QV objects are to be pasted
3) add the appropriate QV object ID (e.g. CH01) to each of the rectangles
4) run the macro
Note: functionality is extended by using prefixes
I've attached a PowerPoint presentation to describe the basic functions and a demo file.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Try This:
Sub CT
ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true
End Sub
Regards,
Arun Goel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arun,
Thanx for the reply. I don't have a problem copying the Table. My problem is pasting it into the Powerpoint Slide. It may be that I need to add a Table first and then paste into each cell. I hope I don't have to do that.
Grant


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Grant,
I recently ran into this and stumbled upon pasting while keeping source formatting. However I think this will only work for PowerPoint 2010 or higher since the command was implemented in this version. I used this code for a macro to copy a table to PowerPoint:
sub ppt
set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
ActiveDocument.Sheets("SH01").Activate
Set obj = ActiveDocument.GetSheetObject("CH01")
Set PPSlide = objPresentation.Slides.Add(1,obj.GetObjectType)
obj.CopyTableToClipboard true
With PPSlide
objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
End With
End Sub
Saw this post while I was searching, and thought that this may be useful to you if you haven't found it yet.
Hope this helps!


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Grant,
I am looking for the same. Did you got the answer?
If you know, Please share to me.
-Sathish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI Jeremiah Kurpat,
I have one prob here. I have looped all the chart and copied to ppt.
If its chart paste as bitmap and if its straigt/pivot paste as table as the above code that u are using.
However , the prob is ,it copies all the tables to first slide and not the specific slide.
Please let me know if you had encountered the same issue.
Thanks,
Sachin


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sachin,
All the charts are copied into same page in PPT?
That means you have to pass add sheets command in the loop or before copy command.
-Sathish


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
With this instruction you can set the diapo where you want your objects to be pasted:
Set PPSlide = objPresentation.Slides(2) 'Change 2 for the number of the diapo you prefer
HTH
Regards.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alex,
Thanks for ur reply.
I am using code (orginal) as below ,
sub ppt
set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
ActiveDocument.Sheets("SH01").Activate
Set obj = ActiveDocument.GetSheetObject("CH03")
Set PPSlide = objPresentation.Slides.Add(1,obj.GetObjectType)
obj.CopyTableToClipboard true
With PPSlide
objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
End With
Set obj = ActiveDocument.GetSheetObject("CH04")
Set PPSlide = objPresentation.Slides.Add(2,obj.GetObjectType)
obj.CopyTableToClipboard true
With PPSlide
objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
End With
End Sub
I tried your code but in vain . It always goes in the second slide. I am sure I am missing something to add above.
Please let me know.
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Satish,
I am looping to all the objects and pasting them in the predefine slidenos. I am able to do it for image successfully but not for table.
Regards,
Sachin

- « Previous Replies
- Next Replies »