Solved

Printer Object / Dot Matrix Priners

Posted on 2000-03-07
2
169 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
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:
bhess1 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

679 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