Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to send reports to PPT at once not working?

Hi,

I have found the below macro in site to send all reports from qvw to PPt all at a once. But it seems not working for me. can anyone let me know what is wrong in this?

sub ppt1

Set PPApp = CreateObject("Powerpoint.Application")
MsgBox("Hello")
PPApp.Visible = True ' Create a presentation
Set PPPres = PPApp.Presentations.Add
'''''''''' For All Sheets '''''''''
for j = 0 to ActiveDocument.NoOfSheets - 1

     ActiveDocument.Sheets(j).Activate
     set ss= ActiveDocument.GetSheet(j)
    shID =ucase(mid(ss.GetProperties.SheetID,10))
     shName=ss.GetProperties.Name

     ActiveDocument.GetApplication.WaitForIdle

     'ActiveDocument.GetApplication.Sleep 5000

     'msgbox shName & "--" & shID
''''''''''''''''''''''''''''''''''''''''''

     ActiveDocument.Sheets(shName).Activate

     ActiveDocument.Sheets(j).Activate
     set s=ActiveDocument.ActiveSheet
     charts=s.GetSheetObjects
           for i=lbound(charts) to ubound(charts)
                if(UCASE(mid(charts(i).getobjectid,10,2)))="CH" then
                     Set PPSlide = PPPres.Slides.Add(1, 1)
                     PPSlide.Shapes(1).Delete ' removes the title
                     PPSlide.Shapes(1).Delete ' removes the text box
                     ActiveDocument.GetSheetObject(charts(i).getobjectid).CopyBitmapToClipboard
                     PPSlide.Shapes.Paste
                     'ActiveDocument.GetApplication.Sleep 1000
                end if
     next
next ''for sheets next move

PPPres.SaveAs "C:\Qlikview\PresentationPPT.ppt"
PPPres.Close
PPApp.Quit
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
end sub

17 Replies
Not applicable
Author

The result of msgbox is showing 'Hello'. again it is stopping in ActiveDocument.Sheets(shName).Activate

marcus_sommer

Have you tried to uncomment these row and/or to a different declaration from shName like:

Set shName=ss.GetProperties.Name

- Marcus

Not applicable
Author

Sorry I am not getting, may be I am confusing can you please post the script?

marcus_sommer

Perhaps this is also helpful: Export all sheets to ppt

- Marcus

marcus_sommer

Within my post above is this example: test script from qv + 3 objects and your macro-code - it worked ...

- Marcus

Not applicable
Author

Thanks and this is really helpful. But when I am executing this every 2 minutes to test it is stopping at ActiveDocument.GetApplication.WaitForIdle

And the PPT is opening with blank page

May I know what is this?

Not applicable
Author

Any Idea of this as It is stucking at ActiveDocument.GetApplication.WaitForIdle

marcus_sommer

WaitForIdle meant to wait until any calculations is finished - for example by selections but it could be that it never will happen if you used some kind of time-functions or variables. I think in your case you don't need this code-row, make it simply a comment or removed it.

- Marcus