Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2016-10-14
6
Medium Priority
?
46 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 49

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 49

Expert Comment

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

Accepted Solution

by:
Karen earned 2000 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 49

Expert Comment

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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Suggested Courses

927 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