Assign Printer device for IE control printing
Good Day Everyone,
Can someone suggest a reliable way to let IE know which printer to use when
printing with the control through VB6?
I am doing a workaround to manipulate the system default printer so that IE
will use the printer we want (see code below). Unfortunately, in spite of
it's elegance (NOT), this plan doesn't always work. In testing, I can see
that Windows has accepted my reassignment of the default printer, then IE
goes ahead and prints to the used-to-be default printer. You are my last
hope before deploying a brand-X web browser control that can probably accept
a printer name argument. Any ideas will be well appreciated! Thanks,
Walter
..
..
..
Case "htm", "html"
OldDefaultPrinterName = GetDefaultPrinterName
SetDefaultPrinter PrinterName
SomeForm.printIe FileName, Copies
SetDefaultPrinter OldDefaultPrinterName
..
..
..
Sub printIe(ByVal FileName As String, ByVal Copies As Integer)
..
..
..
Do While Copies > 0
Copies = Copies - 1
m_PrintedIeFile = False
IeDoc.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, Empty,
Empty
MyUtilityLib.WaitNonBlocking 30, 50, m_PrintedIeFile
If Not m_PrintedIeFile Then
Err.Raise vbObjectError, "print " & FileName, "Timeout Printing
File"
End If
Loop
date: Mon, 15 May 2006 14:50:52 -0400
author: Walter Smerek