Solved

Printing With tabs

Posted on 2001-06-26
9
155 Views
Last Modified: 2010-05-02
Printer.Print Suppcode; Tab; Desc; Tab; Format(!Nett, "#,##0.00"); Tab; bc;

this line of code prints out

12.we32
wall plug
12.00
5600165307432

i want this to appear on  one line of the printout.
like this
12.we32  wall plug          12.00  5600165307432


How do I do this?

***    *********************  ***  ********
**     **************         ***  ********
***    *******************    ***  ********
*****  *********************  ***  ********
***    *****************      ***  ********

if i use spc(n) i get this

***  *********************  ***  ********
**  *****************  ***  ********
***  *********************  ***  ********
*****  *********************  ***  ********
***  *****************  ***  ********




0
Comment
Question by:Eamon
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6227662
You have to use a non-proportional font if you use either of these methods. The width of a space is not the same as a character and this is why you get odd results. If you use the courier font for example which is mono-spaced (i.e., every character including spaces takes up the same amount of space - width & height) then you should see an improvement in the result. Also you should use vbTab as the seperator rather than TAB unless you have declared this and assigned it to the appropriate character (8). If you want more precise control over the position of the text even with proportional fonts then you can investigate the .CurrentX and .CurrentY properties which will allow you to specifically place the elements on the printed page.
0
 
LVL 1

Author Comment

by:Eamon
ID: 6227738
when i try
Printer.Font.Name = "courier"

it sets the font to "news gothic mt"

what's going on here?
0
 
LVL 1

Author Comment

by:Eamon
ID: 6227752
when i try
Printer.Font.Name = "courier"

it sets the font to "news gothic mt"

what's going on here?
0
 
LVL 1

Author Comment

by:Eamon
ID: 6227765
when i try
Printer.Font.Name = "courier"

it sets the font to "news gothic mt"

what's going on here?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 22

Expert Comment

by:rspahitz
ID: 6228247
The old way of printing in columns was to use either the tab character, tab function, or the comma.

For your line:

Printer.Print Suppcode; Tab; Desc; Tab; Format(!Nett, "#,##0.00"); Tab; bc;

I assume that Tab is defined as chr$(9) or vbTab (same thing).  How about trying:

Printer.Print Suppcode, Desc, Format(!Nett, "#,##0.00"), bc;

I haven't tried it, so it may result in the same proportional problems.  It also may mess up if consecutive lines are not in the same tab zone.

The tab function would be (as I recall):

Printer.Print Suppcode; Tab(10); Desc; Tab(40); Format(!Nett, "#,##0.00"); Tab(55); bc;
0
 

Expert Comment

by:mhowling
ID: 6230354
It could well be your version of VB or your printer thats at fault as when I try it in VB6 with a HP Laserjet 4 it appears to work fine.

Alternatively you could write a function to output text at a specified point on the page.  i.e.


Private Sub DrawText(X As Single, Y As Single, Text As String)
    Printer.CurrentX = X
    Printer.CurrentY = Y
    Printer.Print Text
End Sub

AND THEN CALL

DrawText 100,200, suppcode
DrawText 200,200, Desc
DrawText 300,200, Format(Nett, "#,##0.00"
DrawText 400,200, bc

(This could be done in a loop)
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6244738
If it wasn't good enough for better than a "C" grade why accept the comment as an answer without asking for more information. I could have easily improved my response if you had responded to the thread.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6249484
Eamon,
If the answer solved your problem, it deserves an "A".  If it got you in the right direction, maybe a "B".  If it was a bad work-around and you got no support, then maybe a "C"...but only with sufficient communication where you got no further help.

FYI
Some experts look at your grading history and will not assist those who offer "C" grades.  It not only impacts the expert receiving the grade, but also yourself!
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6249487
Eamon,
If the answer solved your problem, it deserves an "A".  If it got you in the right direction, maybe a "B".  If it was a bad work-around and you got no support, then maybe a "C"...but only with sufficient communication where you got no further help.

FYI
Some experts look at your grading history and will not assist those who offer "C" grades.  It not only impacts the expert receiving the grade, but also yourself!

P.S.
If you'd like to change the grade, add a zero-point question in the Customer Support topic area.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

746 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

10 Experts available now in Live!

Get 1:1 Help Now