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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
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

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer
MVP
MVP

There are two drop-down fields on the left side from macro-editor - the settings must be system access.

- Marcus

View solution in original post

17 Replies
marcus_sommer
MVP
MVP

What is wrong? Which error message you received? On which point breaks the execution? Did you see these Msgbox? How are the security settings? Have you installed PP?

- Marcus

Not applicable
Author

Thanks. Yes I have installed PPT. It is showing error as below

ActiveX component can't create object: 'Powerpoint.Application'

marcus_sommer
MVP
MVP

There are two drop-down fields on the left side from macro-editor - the settings must be system access.

- Marcus

Not applicable
Author

Thanks. You are right just now I rectify my mistake .

One more thing The PPT is opening but it is showing blank pages even though the file contains sheets. what Is this error?

marcus_sommer
MVP
MVP

The macro-code contains ucase() and mid() functions on the object-id's, perhaps you must these adjust for you. Also there are two activate-statements ... Create simple msgbox with the object-id or name within the loops to see if the execution how expected ...

- Marcus

Not applicable
Author

Thanks. I tried replacing getobjectid with my chart Id. but still showing same. could you let me know elaborately what is Ucase and MId()

marcus_sommer
MVP
MVP

For me it worked - see attachment with the qv test script. I think that your object-id's not fit to the code.

ucase() - in qv script = upper() - and mid() are string-functions, have here a look in Help.

- Marcus

Not applicable
Author

for me it's not working and it is stopping at

ActiveDocument.Sheets(shName).Activate

Any ideas?

marcus_sommer
MVP
MVP

I think you don't need these code-row, try an uncomment, perhaps i missed the initial set-statement:

Set shName=ss.GetProperties.Name

What is the result of: msgbox "SheetNumber " & j & "  -  " & shName

- Marcus