Solved

printer object -> Papersize

Posted on 2002-05-22
7
294 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
[X]
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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 41
VBA Shell can't Find Word document 11 127
backup program with robocopy 6 69
VBA to find and replace multiline text from VBA modules 8 89
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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…

735 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