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

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

24 Replies
erichshiino
Partner - Master
Partner - Master

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
Author

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

erichshiino
Partner - Master
Partner - Master

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

sona_sa
Creator II
Creator II

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
Creator III
Creator III

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
Author

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
Author

Thanks Erich. Excellent example QVW.

Regards,

Amit

Not applicable
Author

Thanks Erich. Excellent example QVW.

Regards,

Amit

vijetas42
Specialist
Specialist

This macro exporting my chart objects as images into ppt