Solved

Printer Object / Dot Matrix Priners

Posted on 2000-03-07
2
176 Views
Last Modified: 2010-05-02
I am having trouble printing labels (8 down x 4 across) with an OKI dot matrix/A4 printer. I am trying to use the printer object and set the 'PaperSize' property to 256(User defined) and then setting what I think are the right measurements of the page of labels in the 'Height' and 'Width' properties of the printer object.
The 'ScaleMode' property is set to twips. I have no problem getting the height to be high enough but not the width. The widest it will go is the same width as the A4 page.

Can anyone shed light on the situation for me as to what I'm doing wrong or not doing at all?

Thanks in advance.
0
Comment
Question by:mickdoherty
[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
2 Comments
 
LVL 2

Expert Comment

by:damienm
ID: 2592374
If it is an A4 Printer why do you want to print any wider than A4?
0
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 150 total points
ID: 2593404
The maximum width in this case is controlled by your Windows printer driver.  If your driver is coded so that the maximum width is "A4" paper width, then you won't be able to print beyond that using the Printer object.

Assuming that the printer will print wider than "A4", you have two possible answers.  One, find a printer driver that allows you to use the full width capability of the printer.

If you can't find such a driver, you can always send what you need to print directly to the printer.  You will lose a lot of versatility, but if you have to, you have to.  

To do this, you will need to open your LPT: port for binary access, e.g.

 PrintFile = FreeFile
 Open "LPT2" For Binary As #(PrintFile)

Spacing, line feeds, bold, italic, underline, etc. will need to be controlled explicitly.  For example, to switch your printer into and out of 'compressed' print mode, the commands might be:

 CompOn = Chr(15)
 CompOff = Chr(18)

In place of Printer.Print, you would use something like this:

 Global Col as Integer
 Global Row as Integer

 Sub PrintDirect(ByVal S$, Optional ByVal DoCR)

    Put #(PrintFile), , S
    Col=Col + Len(S)
    If DoCR = True Then
        Put #(PrintFile), , vbCrLf
        Col = 1
        Row = Row + 1
    End If

 End Sub

 Sub PositionPrinter(ByVal GotoCol, ByVal GotoRow)

    If GotoCol>Col Then
        Put #(PrintFile), , _
           Space(GotoCol-Col)
        Col = GotoCol
    End If
    Do While Row<GotoRow
        Put #(PrintFile), , _
          Chr(10) ' Line Feed
        Row = Row + 1
    Loop

End Sub

Sub BoldPrint(On)
    If On Then
        Put #(PrintFile), , BoldOn
    Else
        Put #(PrintFile), , BoldOff
    End If
End Sub
Now, printing would be something like this:

  Col=1
  Row=1

  PrintDirect "My Name"  ' Col now = 8

  PositionPrinter 30,3   ' Col=30, Row=3
  BoldPrint True
  PrintDirect "Your Name", True
        ' Col = 1, Row = 4
  BoldPrint False
..
..
..

Hope this helps
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
Suggested Courses
Course of the Month4 days, 3 hours left to enroll

630 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