Solved

Printing in a matrix printer

Posted on 1998-07-24
3
342 Views
Last Modified: 2013-12-03
I am doing a report with de printer object in a matrix printer. This report is bigger than one page. I use fontsize 10 and font type courier, the first page is printed well. In the second page start the problem, it appears characters bigger than the space destinated to them. Then, the print has like a half of the line printed and continue witth the next half line that must be a complet line, and it follows until the end of the page.
I change the fontsize and font each time there is a new page.What is happening, and how I can solve my problem ?
Thank you
pd The printer is an Epson, and it has only few fonts like courier, orator, pica, etc.
Pepe
0
Comment
Question by:al361345
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
kamall earned 200 total points
ID: 1466611
al361345, here is the answer:

Fix Printer Object Font/Paging Quirk
An ‘undocumented feature’ of the VB Printer Object requires that each new page be initialized before the font can be changed.
You would think that the following code would change the current font of the default printer in VB, but you’d be wrong:

    With Printer.Font
    .Name = "Arial"
    .Size = 11
    End With

    sText = "What a waste it is to lose one’s mind."
    Printer.Print sText


This code works as expected:

    ' Start new page
    Printer.Print
    With Printer
    ' Set margins as desired
    .ScaleMode = vbTwips
    .CurrentX = 720
    .CurrentY = 720
    ' Now you can set the font
    With .Font
    .Name = "Arial"
    .Size = 11
    End With

    End With

    sText = "If we don’t succeed, we run the risk of failure."
    Printer.Print sText
    Printer.EndDoc

You MUST initialize each new page using similar code.

Best regards.
0
 

Author Comment

by:al361345
ID: 1466612
Thanks, kamall. I have now another problem. I already wrote my question on the discussion group.
Thank you again.
Pepe
0
 
LVL 7

Expert Comment

by:kamall
ID: 1466613
You are welcome Pepe.
I will check you new question and see if I can help.
Best regards.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now