Solved

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

Posted on 2016-10-14
6
26 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 45

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 45

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 45

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

20 Experts available now in Live!

Get 1:1 Help Now