Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

24 Replies
sachingodhania
Contributor III
Contributor III

Hi Alex,

Thank you very much for trying this out.

However, as I mentioned earlier  the issue is only when I use CopyTabletoClipboard , since I need to  paste it as a table to PPT.

Regards,

Sachin

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi Sachin,

Could you please share your application with sample data.

-Sathish

jerem1234
Specialist II
Specialist II

Hi Sachin!

You should try this code:

sub ppt

set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

For j=1 To 2

  Set PPSlide = objPresentation.Slides.Add(1,12)

next

ActiveDocument.Sheets("SH01").Activate

Set obj = ActiveDocument.GetSheetObject("CH03")

objPresentation.Slides(1).Select

obj.CopyTableToClipboard true

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

Set obj = ActiveDocument.GetSheetObject("CH04")

objPresentation.Slides(2).Select

obj.CopyTableToClipboard true

objPPT.CommandBars.ExecuteMso ("PasteSourceFormatting")

End sub

I found out you don't need the With PPSlide to do Paste Source Formatting since it will paste it in you active slide. So you want to choose the slide you want to paste it on with the statement:

objPresentation.Slides(1).Select


Hope this helps!!

alex_millan
Creator III
Creator III

Hi Sachin,

From my experience, you can not paste the table directly to an empty slide.

If you choose the CopyTableToClipboard method you only paste the data, so if you don't have your table previously created in the slide, you can't paste it there.

Sure there is a workaround to create the table from the vbscript code but I've never test it since my requirements have always been to paste it as image.

Hope someone may help you on this topic. I'll be following the thread for me too, just in case this need would show up at any time.

Good luck and regards

Not applicable
Author

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.