Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

dynamically save various reports as pdf with different filename


Dear All,

I am trying to automatically save various reports as pdf.  Reports should have different file name.  May i kindly ask how to do it in qlikview.

I appreciate your help.

Regards,

79 Replies
Frank_Hartmann
Master II
Master II

strange!!

Try open dynamically save various reports as pdf with different filename

perhaps you are looking to this post from inbox!

Unbenannt.png

Not applicable
Author

Thanks:  tried the code. and have this error.".invalid character"

'''************************************************************************************* 
'''***                                 Export                                            *** 
'''************************************************************************************* 

Public Sub Export     
SET Doc = ActiveDocument 
SET Field = Doc.Fields("BusGrp").GetPossibleValues 
        FieldCount = Field.Count 
        FOR p=0 to Field.Count -1 
        Doc.Fields("BusGrp").SELECT Field.Item(p).Text 
        ActiveDocument.Fields("Year").select "2014"     
        For w= 2014 to 2016 
        ActiveDocument.Fields("Year").select w         
        Set PPApp = CreateObject("Powerpoint.Application") 
        PPApp.Presentations.Open "D:\Qlik\AdhocReports\Turnover\Exporttemplate.pptx"   
        'PPApp.Presentations.Open "C:\Users\Admin\Desktop\Export\Exporttemplate.pptx"     
        PPApp.Visible = True 
        Call PPApp.Activate 
ActiveDocument.Sheets("Exec1").Activate     'adapt your Sheet ID
'First Chart
ActiveDocument.GetSheetObject("CH556").CopyBitmapToClipboard  'adapt your Object ID
ActiveDocument.GetApplication.WaitForIdle
with PPSlide.Shapes.Paste
  .Left  = 300      'adapt position here
  .Top  = 25      'adapt position here
end with 
'Second Chart
ActiveDocument.GetSheetObject("CH563").CopyBitmapToClipboard  'adapt your Object ID
ActiveDocument.GetApplication.WaitForIdle
with PPSlide.Shapes.Paste
  .Left  = 50      'adapt position here
  .Top  = 100      'adapt position here
end with 
'Third Chart
ActiveDocument.GetSheetObject("CH551").CopyBitmapToClipboard  'adapt your Object ID
ActiveDocument.GetApplication.WaitForIdle
with PPSlide.Shapes.Paste
  .Left  = 300      'adapt position here
  .Top  = 25      'adapt position here
end with 
'Fourth Chart
ActiveDocument.GetSheetObject("CH544").CopyBitmapToClipboard  'adapt your Object ID
ActiveDocument.GetApplication.WaitForIdle
with PPSlide.Shapes.Paste
  .Left  = 50      'adapt position here
  .Top  = 100      'adapt position here
end with       
          set v=ActiveDocument.Variables("vFinal") 
           getVariable = v.GetContent.String  
           filePath = "D:\Qlik\AdhocReports\"&getVariable&".pptx"   
          'filePath = "C:\Users\Admin\Desktop\Export\generated_Reports\"&getVariable&".pptx"            
           PPApp.ActivePresentation.SaveAs filePath 
           PPApp.ActivePresentation.Close                                         
        Next     
        Next         
   
End Sub     

Frank_Hartmann
Master II
Master II

is

ActiveDocument.Sheets("Exec1").Activate 'adapt your Sheet ID

your Sheet ID or the Name of the Tab??

You need to fill in below information:

Aufnahme_2016_10_31_11_57_29_497.gif

In which line of code do you get the error?

Not applicable
Author

it's the sheetID.

It also says "macro parse failed.  Functionality was lost"

thank you for your patience and help.

Frank_Hartmann
Master II
Master II

try this:

Ctrl+Shift+M and then Check: Give System Access to Module Script

Frank_Hartmann
Master II
Master II

I found an error in my macro. there was some missing code. I tested this code with your attached qvw and for me this is  running fine now. Just copy paste the attached content to your module an execute it.

Aufnahme_2016_10_31_14_34_20_110.gif

Not applicable
Author

Frank,

thank you so much.  it now saves the file as "-2014" and "-2015" and "-2016'

We are getting near to what i need.

Please update the code to select 2014 (Year) and then select teh BusGrp one by one...(2014 company1, 2014 Company 2, 2014 Company 3, 2014 Company 4 and up to 7 companies, when done, the macro should select the next year which is 2015 (Year) and then select the BusGrp as well until it selected all the BusGrp, and then move to the next Year (which is 2016) and then select the BusGrp one by one.

Save all the files as year - busgrp

Regards,

Frank_Hartmann
Master II
Master II

i have attached the macro! First it selects 2014 and then loops through BusGrp, then selects 2015 and loops again through BusGrp,

then selects 2016 and loops again through BusGrp :

Aufnahme_2016_11_01_18_58_43_589.gif

Tested with your former attached qvw.

works fine for me!

Not applicable
Author

Yeah, I could see that from your attachment.

Just wondering why in my machine, it saves only the year ('-year') without the BusGrp, thus overwriting the previously save file and I ended up with the last selection.  the files saved are "-2014", "-2015", "-2016"

is there any tweaking that I need to do?

Not applicable
Author

Hi, sorry, found the problem.

the field in variable  vFinal is not BusGrp but Business Group.  Both fields are available.

Adjusted it and work, perfectly.

Many thanks for your help..