Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
There are two drop-down fields on the left side from macro-editor - the settings must be system access.
- Marcus
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
Thanks. Yes I have installed PPT. It is showing error as below
ActiveX component can't create object: 'Powerpoint.Application'
There are two drop-down fields on the left side from macro-editor - the settings must be system access.
- Marcus
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?
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
Thanks. I tried replacing getobjectid with my chart Id. but still showing same. could you let me know elaborately what is Ucase and MId()
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
for me it's not working and it is stopping at
ActiveDocument.Sheets(shName).Activate
Any ideas?
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