Solved

Printing issue on VB6 using Printer Object Property "PaperSize" for custom size paper

Posted on 2016-10-14
6
31 Views
Last Modified: 2016-11-06
Having issues while printing custom size paper (8.5X7) on manual tray of Xerox (Work Center 7545) Printer. Even though specifying the printer to pull paper from the manual feed its pulling from the default tray. Below is the code I'm using

Code:
Dim x1 As Printer
    For Each x1 In Printers
     If x1.DeviceName = Printer.DeviceName Then
            Set Printer = x1
            Printer.Height = (7 * 1440)
            Printer.Width = (8.5 * 1440)
            Printer.PaperSize = vbPRPSUser
            Printer.PaperBin = 258 'Mannual
            Exit For
        End If
    Next
0
Comment
Question by:sp
  • 3
6 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41844233
Try vbPRBNManual (which has a value of 4) instead of 258.

This page lists the properties.
0
 

Author Comment

by:sp
ID: 41846780
Hello Martin,
Thank you for your response. Getting "Invalid Property value" when i set the PaperBin value to vbPRBNManual.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41846877
Maybe this Microsoft article will be of some use.
0
 
LVL 9

Accepted Solution

by:
Karen earned 500 total points (awarded by participants)
ID: 41847617
You will need to find what the PaperBin value is for your particular printer.
To do this, go into your printer settings and change the printer to default to "Paper source" = "Manual Feed".
Then go into your VB program and see what the PaperBin value is:
MsgBox Printer.PaperBin
or
Debug.Print Printer.PaperBin
will give you the number to use.
Now you can change your printer settings back to what they were before.
1
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41848535
Good idea Karen.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When I recently replaced my image transfer kit on my office HP color laserjet 5550dn printer, I had a slight problem.  The left bracket that holds the transfer kit got stuck in the upright locked position instead of being at a 45 degree angle facing…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now