|
-
August 20th, 2001, 12:07 PM
#1
How to set the Global Printer object, using the Common Dialog without modifying the system default p
I am trying to set the global printer object to point to a network printer using the following code.
private Sub Form_Click()
Printer.TrackDefault = true
DefaultPrinter = Printer.DeviceName
CommonDialog1.PrinterDefault = true
CommonDialog1.Orientation = cdlLandscape
CommonDialog1.Copies = 1
CommonDialog1.CancelError = true
on error GoTo ErrHandler
CommonDialog1.Flags = cdlPDDisablePrintToFile _
Or cdlPDHidePrintToFile _
Or cdlPDNoSelection _
Or cdlPDReturnIC
Form1.CommonDialog1.ShowPrinter
MsgBox (Printer.DeviceName)
Printer.Copies = CommonDialog1.Copies
Printer.Orientation = CommonDialog1.Orientation
Printer.ScaleMode = vbTwips
Printer.print "Some Text"
Printer.EndDoc
ErrHandler:
' User pressed Cancel button.
Exit Sub
End Sub
However, this piece of code will eventually go into a control that will be accessed through a web browser environment. I can not be sure that the clients machine will alow me to change the default printer. So this not acceptable.
Does anyone have example code that sets the Printer object to that selected by the user of the CommonDialog box, but without affecting the system default settings?
Simon Pettman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|