Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

automatically print report on harddrive printer

Hello,

does anyone know how to print a Report for example REP01 via macro on a real printer?

(i would start the macro every time, when i load the script) i'm worry about selecting the report manually to print it...

best regards

Ingo

1 Reply
marcus_sommer

With name & target in a tablebox, which read per loop:

Set WSHShell = CreateObject("WScript.Shell") 'create new object

if WshShell.RegRead ("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device") <> "QlikViewPDF" Then 'Read Registry

      WSHShell.RegWrite "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device", "QlikViewPDF", "REG_SZ" 'Set Registry                     

end if

set TableBox = ActiveDocument.GetSheetObject( "TB01" )

for RowIter = 0 to TableBox.GetRowCount-1

    set rep = TableBox.GetCell(RowIter,0)

    set outputFile = TableBox.GetCell(RowIter,1)

    WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", outputFile, "REG_SZ"

    WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"

    ActiveDocument.GetApplication.Sleep 50

    ActiveDocument.PrintReport rep

next

By another printer as QlikViewPDF the statement for outputFile and automatically print are different but the logig for several prints per loop is the same - see APIGuide.qvw and AutomaticReference.pdf in your install-folder and many post here.

- Marcus