Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Export multiple objects to a single powerpoint slide

Can anyone provide sample code for a macro to export multiple objects into a single powerpoint slide.

Looks like there are no previous discussions regarding this topic.

All the discussions only tell about pasting a single object per slide.

I would really appreciate it, if someone sheds light on this topic.

Thanks,

Bharath

Tags (1)
22 Replies
erich_shiino
Honored Contributor

Re: Export multiple objects to a single powerpoint slide

Hi,

I adapted DV's code from this post:

http://community.qlik.com/message/196413#196413

Sub ExportPPT

ActiveDocument.ActiveSheet.FitZoomToWindow

Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

    For i = 0 To ActiveDocument.NoOfSheets - 1

   '     Set MySheet = ActiveDocument.GetSheet(i)

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

   '     ActiveDocument.ActiveSheet.CopyBitmapToClipboard

                       ActiveDocument.GetSheetObject("CH03").CopyBitmapToClipboard

        PPSlide.Shapes.Paste

                       ActiveDocument.GetSheetObject("CH04").CopyBitmapToClipboard

        PPSlide.Shapes.Paste

    Next

Set PPSlide = Nothing

Set PPPres = Nothing

End sub

This will export charts CH03 and CH04

Hope this helps,

Erich

Not applicable

Re: Export multiple objects to a single powerpoint slide

Thanks for the prompt reply Erich.

The script you posted allows me to copy objects only from my Active sheet on to a slide.

But, I want to copy objects from other sheets as well.

To do this I have tried to manually set the active sheets but in vain.

Sub ExportPPT

Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add(True)


Set Sheet1= ActiveDocument.Sheets("SH04")
Set PPSlide = objPresentation.Slides.Add(objPresentation.Slides.Count + 1,11)

PPSlide.Shapes(1).TextFrame.TextRange.Text = "Productivity Tracking"
Sheet1.GetSheetObject("CH34").CopyBitmapToClipboard
PPSlide.Shapes.Paste
Sheet1.GetSheetObject("CH05").CopyBitmapToClipboard
PPSlide.Shapes.Paste
Sheet1.GetSheetObject("CH35").CopyBitmapToClipboard
PPSlide.Shapes.Paste

Set Sheet2= ActiveDocument.Sheets("SH10")
Set PPSlide = objPresentation.Slides.Add(objPresentation.Slides.Count + 1,11)
PPSlide.Shapes(1).TextFrame.TextRange.Text = "Hiring"
Sheet2.GetSheetObject("CH37").CopyBitmapToClipboard
PPSlide.Shapes.Paste
Sheet2.GetSheetObject("CH38").CopyBitmapToClipboard
PPSlide.Shapes.Paste

Set PPSlide = Nothing
Set PPPres = Nothing

End sub

This is the error I receive.

Object doesn't support this property or method: 'Sheet1.GetSheetObject'

How can I actually select what objects I want from different sheets?

I would also love to know, how I can control the positions of the objects on the slide?

Thanks,

BharathBK

erich_shiino
Honored Contributor

Re: Export multiple objects to a single powerpoint slide

Are the objects in those sheets minimized? When I tried before, it didn't work.

You can try to activate the sheet before copying the object:

ActiveDocument.ActivateSheetByID "SH01"

It may also be necessary to restore the object (if it is minimized) with something like this:

ActiveDocument.GetSheetObject("CH03").Activate

I did a quick search, trying to control how to position the object when it is pasted, but I couldn't find a way. It would depend on the syntax provided by powerpoint itself...

Hope this helps,

Erich

akumar_c
Contributor

Re: Export multiple objects to a single powerpoint slide

Hi Erich,

Do you have any macro for

Export multiple Sheets as a image to a single powerpoint slides.

Suppose I have an QV Application and I want to send all the sheets as a image to multiple Slide in a Single PPT.

Please help me on this.

Regards,

AKumar

sureshbaabu
Contributor III

Re: Export multiple objects to a single powerpoint slide

Hello Erich,

I'm Not sure if you have fixed the issue by now.

You can use the follwing the positon the objects when you place them on PPT. Set values for ( .Left, .top, .width, .height)

ActiveDocument.GetSheetObject("P2T2").CopyBitmapToClipboard
with PPSlide.Shapes.Paste
.Left = 150
.top = 350
.width=50
.height=90
end with

Hope it helps you!!!

I need your help in fixing my issue with PPT. I have 2 objects, one on 1st sheet and 2nd on the next sheet. I was able to export the object on 1st sheet to the ppt and could not export the 2nd one, Beacuse it was not the  Active sheet. I tried You method above but I could not get that. Could you please help me fixing this issue?

 

Not applicable

Re: Export multiple objects to a single powerpoint slide

Hi,

A 720 width will give you objects of the maximum width of the slide, and as it is grow the bitmap proportionally, you end up with a clean mage or table...

Cheers

Not applicable

Re: Export multiple objects to a single powerpoint slide

Thanks Erich. Excellent example QVW.

Regards,

Amit

Not applicable

Re: Export multiple objects to a single powerpoint slide

Thanks Erich. Excellent example QVW.

Regards,

Amit

vijetasharma
Contributor III

Re: Export multiple objects to a single powerpoint slide

This macro exporting my chart objects as images into ppt

Community Browser