Solved

Printing With tabs

Posted on 2001-06-26
9
156 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

910 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

26 Experts available now in Live!

Get 1:1 Help Now