Back

Topic

[KB337]How to print a document on a specific Printer

Tags: Print

14 years ago
By RM
Options
Print
Applies to:

PcVue all versions.
While the basic content of this article remains valid, details may have changed since it was written.


Summary:

A way to print a document on a different printer to the Windows’ default.


Details:

A VBA module which allows the default printer to be changes. Then it is easy to print a document with the command line (Shell “Write /p file.txt”). After you can come back to the previous default printer. This module has been tested on PcVue 720d VBA under Windows XP. It should work on other versions of PcVue supporting VBA.

Below is a sample of code, executed from a mimic button, to print a specifc document on a specific printer (PDF995) :

Dim PathFile As String
Dim PrinterName As String
Dim DefaultPrinterName As String

PathFile = “””” & ThisProject.Path & “\TP\Test.txt” & “”””
DefaultPrinterName = ModPrinter.DefaultPrinter()
PrinterName = “PDF995″‘
PrinterName = “Microsoft XPS Document Writer”‘
PrinterName = “Auto RICOH sur Lyonsrv”

Shell “WRITE /p ” & PathFile
ModPrinter.ChangeDefaultPrinter (PrinterName)
ModPrinter.ChangeDefaultPrinter (DefaultPrinterName)

Download attachments: ModPrinter.zip


Created on: 30 Dec 2010 Last update: 04 Sep 2024