Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

printer object -> Papersize

Posted on 2002-05-22
7
287 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

839 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