Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printer Object / Dot Matrix Priners

Posted on 2000-03-07
2
Medium Priority
?
177 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 450 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

705 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