Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort Objects on Power Point export not working, any clues?

I have 33 minimized charts on one tab that i want to export to ppt. I am using the code shared below and everything is working awesome other than sorting part. My charts are numbered (object id) from straight 1 to 33 but stil i am getting as if its downloading randomly.

Below is macro that I am using for this. I would really appreciate every help from you guys. Is there something that I am doing wrong?

sub Export

Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True ' Create a presentation

Set PPPres = PPApp.Presentations.Add

set s=ActiveDocument.Sheets("Export to PPT")
charts=s.GetGraphs  

        

for i = UBound(charts) - 1 To 0 Step -1 
for j= 0 to i  
    if charts(j).getobjectid>charts(j+1).getobjectid then

        set temp=charts(j+1)  
        set charts(j+1)=charts(j)  
        set charts(j)=temp   
        end if 
      next
    next 


for i=lbound(charts) to ubound(charts)
  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).maximize
  ActiveDocument.GetSheetObject(charts(i).getobjectid).CopyBitmapToClipboard
  ActiveDocument.GetSheetObject(charts(i).getobjectid).minimize
  with PPSlide.Shapes.Paste
      .Left = 30
      .Top = 70
      .Width=660
     
end with
next


PPPres.SaveAs "C:\DC-DC.ppt"
'PPPres.Close
'PPApp.Quit
Set PPSlide = Nothing
Set PPPres = Nothing

0 Replies