Solved

printer object -> Papersize

Posted on 2002-05-22
7
260 Views
Last Modified: 2010-05-18
This is bit tricky. I have two printers. One of the printers is connecting theUSB cable and the other one connecting the serial cable.

One of the printer prints in a regular paper and the other one have to print on a form (8.5 *3.66 inch).

According to the printer technical support, we set the form size in printer properties.

In code:

'This is to set the printer name to print form
Dim idx As Long
Dim p As Printer
Dim X As Long
For Each p In Printers
If (p.DeviceName = "form") Then
Set Printer = Printers(idx)
End If
idx = idx + 1

Next p

Printer.Width = 8.5 * 1440 '11520
Printer.Height = 3.66 * 1440 '5268

Printer.ScaleMode = vbCentimeters '5 'set to inch

Printer.Print "pirnting"
Printer.Print "pirnting"
Printer.Print "pirnting"
Printer.Print "pirnting"
Printer.EndDoc

'This is to set the printer name to print report (this is the one printing on regular paper)
Dim idx As Long
Dim p As Printer
Dim X As Long
For Each p In Printers
If (p.DeviceName = "report") Then
Set Printer = Printers(idx)
End If
idx = idx + 1
Next p
'Printing a report here….
rept.PrintReport

This is the code I am executing. My problem, the form is printing good on the first two times, but after that it’s printing on every third form (3.66 is 1 third of regular paper length).
I message out printer.height and printer.width to check. On the first time I am getting
H: 5270 (3.66)
W: 12240 (8.5)

Second time:
H: 15840 (11)
W: 12240 (8.5)

That means my setting of printer.height = 8.5 * 1440 and printer.width = 3.66 * 1440 is not getting affect.

Can anyone help me please?

Thank you,
Kethees
0
Comment
Question by:kethees
7 Comments
 
LVL 3

Expert Comment

by:ketapillar
ID: 7027379
What type of printers are they? Model Numbers
0
 
LVL 3

Expert Comment

by:ketapillar
ID: 7027383
We have Epson LQ-570+ (dot matrix pos's) and the driver for them does not hold the correct papersize.  Instead we had to use another driver (from another epson printer) to hold the correct paper size.

I ended up having to call tech support pay them $20 (out of warranty) for them to tell me the correct drivers to use.
0
 

Author Comment

by:kethees
ID: 7027402
to print the form, i am using Lexmark 2480 (form printer)
and to print the report, using Epson 880

Adidtional comment:
'this is to set the printer name to print wave bill
   Dim idx As Long
   Dim p As Printer
   Dim X As Long
   For Each p In Printers
      If (p.DeviceName = "report") Then
         Set Printer = Printers(idx)
      End If
      idx = idx + 1
       
   Next p
   
   MsgBox "wedth " & Printer.Width / 1440
   getting: 8.5
   MsgBox "hei " & Printer.Height / 1440
   getting: 3.66
   Printer.Width = 8.5 * 1440 '11520
   Printer.Height = 2 * 1440 '5268
   MsgBox "wedth " & Printer.Width / 1440
   getting: 8.5
   MsgBox "hei " & Printer.Height / 1440
   getting: 11
   Printer.ScaleMode = vbCentimeters '5 'set to inch
   Printer.Print "testing some new print"
   Printer.EndDoc
   MsgBox "wedth " & Printer.Width / 1440
   getting: 8.5
   MsgBox "hei " & Printer.Height / 1440
   getting: 3.66

That seems like, my setting is not getting any affect.:(
0
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

 
LVL 2

Expert Comment

by:ventond
ID: 7028371
I don't know as this will help, but I found the printer object to be very finicky about accepting changes. Instead of using the Printer Object can you try breaking out of your loop when you find a match and then using p instead of Printer?

If that doesn't work, I think your command "Set Printer = Printers(ndx)" should be "Set Printer = p". Since a collection (which Printers is) doesn't necessarily have to have sequential indexes.

0
 
LVL 1

Expert Comment

by:tandrei
ID: 7028980
I had this problem too, in fact I was not able at all to modify the paper size on a HP LJ printer. I am using the common dialog Showprinter to select the paper size, but the [printer object seems not to be aware of any changes
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7818392
Hi kethees,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

kethees, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7909871
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

708 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

17 Experts available now in Live!

Get 1:1 Help Now