Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everybody:
I am using the next macro to print automatically one report for diferents suppliers:
Sub ReportPrint
Set soc = ActiveDocument.Fields("Supplier Description")
Set socPossible = soc.GetPossibleValues
For i = 0 to socPossible.Count-1
soc.Select socPossible.Item(i).Text
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.PrintDocReport "RP05", "PDFCreator"
Next
End Sub
The macro works very good, but I would like to complete it, inserting the name of every pdf automatically with the combination of three fields: "Supplier Description";"Year" and the Last "Month".
Thanks in advance.
Hi Iñigo,
You can create an object type PDFCreator and configure the PDF filename like this:
- Get the field values for "Year" and the Last "Month" as you are already doing for "Supplier Description"
- Create a string variable for the report filename (ex. Dim sPDFName) and stuff it with the desired field values (ex. sPDFName = ReportName & " - " & FieldValue)
- In the PDF object type, configure the item .cOption("AutosaveFilename") = sPDFName
Like the code below:
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
If .cStart("/NoProcessingAtStartup", True) = False Then
Exit Sub
End if
.cVisible = True
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
I got this from Qlik Tips: Qlik Tips: Printing Reports to PDF using PDFCreator
Regards,
Marina C.
Iñigo, If it was useful, why don't you mark as answered?