?
Solved

Printing With tabs

Posted on 2001-06-26
9
Medium Priority
?
162 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
[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
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

765 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