Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Export a Straight Table to Power Point (PPT) using Macro


Hi All,

I need to export one Straight Table to a Power Point [may be using a button] using Macro.

Any valuable suggestions will be appreciated.

Regards!!!

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Finally got it, however it will only work with PowerPoint 2010 and greater. They added a command to keep source formatting in this version which works with the copied table. Try this set of code:

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

Hope this helps!

View solution in original post

12 Replies
dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi All,

I used the below Macro. Its getting functioned properly.

Sub Export()

set obj = ActiveDocument.GetSheetObject("CH01")

obj.ExportBiff "C:\Users\dicky\Documents\Export.ppt"

End Sub

But afterwards am unable to open the desired PPT. Its throwing below error. Please suggest.

Error.png

dmohanty
Partner - Specialist
Partner - Specialist
Author

Any help please???

jerem1234
Specialist II
Specialist II

Here try this set of code:

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)

  ActiveDocument.GetSheetObject("CH01").CopyBitmapToClipboard

  PPSlide.Shapes.Paste

End Sub

This should open up your Powerpoint with the image pasted, then you can save it wherever.

Hope this helps!

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Along with the "Jerem1234" code, make sure to set the module security to "System Acess" & Local security to "allow system access" in macro editor.

dmohanty
Partner - Specialist
Partner - Specialist
Author

Great Mr. Phani...

Your solution was just a finishing touch.

Could you please let me know the functionality of the solution you have suggested?

Regards!!!

dmohanty
Partner - Specialist
Partner - Specialist
Author

Thanks a lot Jerem,

This really helped along with the solution provided by Phaneendra.

Kudos to both!!!

jerem1234
Specialist II
Specialist II

Would you mind marking this discussion as correct/helpful so that others may find this as useful.

Thanks!

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Jerem and Phani,

The exported thing to PPT was just a screenshot of the Straight Table. Users can't se the full set of records.

Now my requirement is to send the full records to PPT and that too in editable mode. Users can change the values of their own too.

Something like in this attached example. Please help.

Regards!!

jerem1234
Specialist II
Specialist II

Hmm... I rewrote the code, but I am having trouble pasting it in PowerPoint. Seems like PPSlide.Shapes.Paste isn't doing the trick. The code below will copy table to clipboard, and you can manually hit paste or cntrl-v in the powerpoint, but for some reason the PPSlide.Shapes.Paste isn't working. The code I have is below:

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

  'PPSlide.Shapes.Paste

End Sub

Maybe someone else can resolve this issue?