Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Assign Printer device for IE control printing

0 views
Skip to first unread message

Walter Smerek

unread,
May 15, 2006, 2:50:52 PM5/15/06
to
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


0 new messages