|
-
Mar 18th, 2016, 10:36 AM
#1
Thread Starter
New Member
Printer object valid for devicename, but not for other properties and methods
I am trying to modify some code that was written by a previous employee. The code saves the default printer (prt-x), changes the default to a different printer (prt-y), prints a label, then changes back to the original default printer (prt-x). My modification is to check the customer, and for 1 customer, change the default to printer prt-z, but for all others change to prt-y. In both cases, the original default printer is restored. The code has not problem changing the default printer. But when the sub is called to print the label, the "Printer.DeviceName" is valid, but all other properties give me an run-time error 482. When I debug, I get that all the properties (except DeviceName) have a printer error (e.g., the Printer.ScaleMode=<printer error>).
Here is the PrintLabel sub:
Private Sub PrintLabel(ByVal Customer As String)
Debug.Print Printer.DeviceName
If Customer <> "99131" Then
Canvas.ObjDraw1.UnSelectAll
Printer.ScaleMode = 1
Printer.Width = 4 * 1440
Printer.Height = 6 * 1440
Printer.ColorMode = 1
Printer.PaintPicture Canvas.ObjDraw1.Image, 0, 0, Printer.Width, Printer.Height
Printer.EndDoc
Else
Canvas2.ObjDraw1.UnSelectAll
Printer.ScaleMode = 1
Printer.Width = 4 * 1440
Printer.Height = 1.5 * 1440
Printer.ColorMode = 1
Printer.PaintPicture Canvas.ObjDraw1.Image, 0, 0, Printer.Width, Printer.Height
Printer.EndDoc
End If
End Sub
More info: The label printer that I am trying to print to is shared on a different computer (computer name = "FPMCUPS3"). The printer name is "ItemLabels", and the Printer.DeviceName returns "\\FPMCUPS3\ItemLabels".
Can anybody help me determine why I am getting <printer error> for all the properties, except for DeviceName?
Tags for this Thread
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
|