Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

surynnchin
New Contributor III

Export all sheets to ppt

Hi Community

I got the following macro but it will only export the active sheet and also the image got truncated.

sub exportppt

Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

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

ActiveDocument.ActiveSheet.CopyBitmapToClipboard

PPSlide.Shapes.Paste

Set PPSlide = Nothing

Set PPPres = Nothing

Set PPApp = Nothing

End Sub

How can i export all the sheets in the application into different slides without the image being truncated?

20 Replies
Highlighted
Siva_Sankar
Honored Contributor

Re: Export all sheets to ppt

autopilot
Contributor III

Re: Export all sheets to ppt

Try this.....

sub exportppt

Set objPPT = CreateObject("PowerPoint.Application")

objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Add

PPSlideNo = 1

For i = 0 to activedocument.noofsheets -1

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

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.ActiveSheet.CopyBitmapToClipboard

PPSlide.Shapes.Paste

Set PPSlide = Nothing

Set PPPres = Nothing

Set PPApp = Nothing

activedocument.nexttab

PPSlideNo = PPSlideNo + 1

NEXT

End Sub

surynnchin
New Contributor III

Re: Export all sheets to ppt

Thanks Siva. But i read this 2 posts before their macro scripts didn't work for me.

sunilkumarqv
Valued Contributor II

Re: Export all sheets to ppt

Hi SurynnChin

Your are actually on the way use for conditions    for no of sheets

For i = 0 To ActiveDocument.NoOfSheets - 1

   '     Set MySheet = ActiveDocument.GetSheet(i)

Hope it helps

surynnchin
New Contributor III

Re: Re: Export all sheets to ppt

The macro did allow me to copy the image for all sheets in the qv to a ppt slide but however the images got truncated. Any idea for this? Attached a sample app with your macro QlikView demo: Credit Risk Management and the export ppt.

autopilot
Contributor III

Re: Export all sheets to ppt

At first it did not make sense that the images were truncated, but after running it on my side and comparing results with your pptx I know what the issue is.

The images are actually not truncated. Rather, the image is only what was visible/in view for the qvw app when the macro executes. So, for example, resize the qlikview window to really small and then execute macro (output images are really small). Then resize window to as big as you can make it on the monitor and execute macro (output images as big as you could make it on your monitor).

This proved challenging to explain. Let me know if this doesn't make sense and I'll attempt to illustrate again. Hope that helps!

surynnchin
New Contributor III

Re: Export all sheets to ppt

Thanks for you explanation.

Is it possible to output the image after i fit zoom to window?

autopilot
Contributor III

Re: Export all sheets to ppt

I'm sorry....I don't understand your question.

Are you saying - is it possible to fit the zoom to window (using macro) and then export image to ppt?

Re: Re: Export all sheets to ppt

Add the following four statements to your macro, immediately after the SUB header:

    ActiveDocument.ActiveSheet.FitZoomToWindow

    ActiveDocument.GetApplication.WaitForIdle

    ActiveDocument.GetApplication.Refresh

    ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

Community Browser