I'm having trouble setting the paper size and the paper bin in the printer object. I've tried the following code.

If cboPaperSize.ListIndex = 0 Then
Printer.PaperSize = 1
Else
Printer.PaperSize = 5
End If
If cboPaperSource.ListIndex = 0 Then
Printer.PaperBin = 7
Else
Printer.PaperBin = 4
End If
End If

This works fine at my workstation, but when I run it on a clients computer it crashes here. I haven't really had time to debug it, because I can only make the changes here, and test them there. It's really inefficient. So It may just be one of the two. I'm thinking it might be a paperbin problem, for example if the printers in their collection only have the one bin (manual) then it might crash. Please help.

Recommended Answers

All 4 Replies

The only real way to find out, is to have the VB IDE running the program when it crashes, so that the debugger can highlight the problem line. I'm guessing that you are compiling it to an EXE and then running it on the client machine. It may be a paperbin problem if the system doesn't have it on the client machine. You SHOULD be able to test for how many bins there are and if there is only one, just don't mess with it.... let me know what you come up with.

What I ended up doing was created some test functions that attempts to change the bin property, as well as size and orientation. If an error occurs it flags that property as read only and disables the corresponding comboboxes, radio button, etc.

Good Solution. I also appreciate you posting your solution to the site, so that others with similar problems have a chance to fix the same issue. Thanx.

Anytime, I've learned a lot from this site, so I'm more than happy to give back.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.