Solved

printer object -> Papersize

Posted on 2002-05-22
7
281 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

813 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

14 Experts available now in Live!

Get 1:1 Help Now