Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
niegel
Partner - Contributor II
Partner - Contributor II

Macro for PDF File generation

I'm using QlikView to generate reports... I'm wondering if there is a macro that would...

(1) Generate a PDF file for each user that I have. (field is TCode)

(2) Use PDF functionality other than QlikViewPDF.

(3) Auto save to specific location with the Tcode or other field as part of the file name.

Any help is greatly appreciated.

Niegel

2 Replies
yblake
Partner - Creator II
Partner - Creator II

In response to (2) this is a routine to load installed printer in a variable input box predefined values list. To print in another PDF printer, like i.e. CutePDF, you use .printex method.

'=============================================================================================
'Available printer
'=============================================================================================
sub SetPrinterList

' Get active printers (This will need "system access" security on)
set nw = CreateObject("WScript.Network")
set pr = nw.EnumPrinterConnections
redim lv((pr.Count/2))
lv(0) = "Default"
For i = 1 to pr.Count Step 2
lv(1+((i-1)/2)) = pr.Item(i)
Next
set pr = nothing
set nw = nothing

' Define printer list
set vr = ActiveDocument.Variables("PRINTER")
vp = vr.GetProperties
vp.PreDefinedList = lv
vp.ConstraintsFlag = 3 ' Predefined values only
vp.UseMRU = false
vp.UsePredefListedValues = true
vp.UsePredefNumberSeries = false
vp.UseScroll = false
vr.SetProperties vp
set vr = nothing

' Refresh Input Box content, set to "default" printer
set ib = ActiveDocument.GetSheetObject("IB01")
set bp = ib.GetProperties
if bp.Layout.MemberAttributes(0).Name.v = "PRINTER" then
' Default will need .Printout method, others will need .Printex
ib.SetVariableContent 0,"Default",false
end if
set bp = nothing
set ib = nothing

end sub

User selection may be retrieved by :

set vr = ActiveDocument.Variables("PRINTER")
gsPrinter = vr.GetContent.String
set vr = nothing

Not applicable

When the PDF is up for discussion. Does anyone know if it is possible to make a macro that creates a pdf from a predefined report and attaches it to a outlook email template?