Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do you print line by line 1

Status
Not open for further replies.

locnar

Programmer
Dec 12, 1999
2
US
I want to have my program print a single line of text to the printer without it form feeding
 
The following code can be put onto button &quot;Command1&quot;.<br>
It prints two lines, the first line ends with &quot;;&quot; and therefore does not cause CRLF on the printer.<br>
<br>
<br>
Private Sub Command1_Click()<br>
Printer.Print &quot; this is a line of text&quot;;<br>
Printer.Print &quot; this continues the line.&quot;<br>
Printer.EndDoc<br>
<br>
End Sub<br>
<br>
Hope this is what you want
 
Hi,<br>
<br>
Can I just say that we use the printer object for small type reports and its extremely fast. You can do a good bit with it.<br>
<br>
I recommend all programmers to investigate it, as jo0hncb shows, its very easy to use.<br>
<br>
C
 
I want to print a single line from a running program without the program sending a form feed. <br>
1 The program receives a serial string <br>
2 The programs filters the string <br>
3 The program prints out the string on one line <br>
4 the program waits for the next string <br>
5 the program prints the string on the next line <br>

 
After the program filters the string, put the following line before EXIT SUB:<br>
<br>
Printer.Print STRING<br>
<br>
It will advance to the next line when it is read again.<br>
<br>
Be Aware, this will tie up the printer until the program ends.
 
Try this to achieve what I think that you are trying to do:<br>
(I am going to assume that you are printing to the printer device)<br>
<br>
.<br>
.<br>
.<br>
Printer.Print Chr(13); Chr(10); &quot;This is your line of text&quot;;<br>
.<br>
.<br>
.<br>
<br>
This will be in a loop somewhere, waiting for a string and when it gets one it will execute the print line above. What that line does is to create a new line and then print on it, leaving the latest line printed as the bottom line.<br>
<br>
HTH,<br>
<br>
John<br>

 
THERE ARE TWO WAYS TO PRINT LINE BY LINE
1)USE OPEN STATEMENT

Open &quot;LPT1:&quot; For Output As #1
Print #1, Tab(4);TEXT1; Tab(19); TEXT2; Tab(33); TEXT3'FIRST LINE
Print #1, Tab(4);TEXT1; Tab(19)'SECOND LINE
.....AND SO ON
Close #1
2) USE OPEN STATEMENT TO MAKE A FILE
Open &quot;C:\TEST\PR.TXT&quot; For Output As #1
PRINT ...... THE SAME ABOVE
CLOSE #1
BEFORE THAT MAKE A BAT FILE FOR EXAMPLE C:\TEST\PR.BAT WITH THE PHRASE:
COPY C:\TEST\PR.TXT PRN
THEN FROM VB PROJECT:
CALL SHELL(&quot;C:\TEST\PR.BAT &quot;,vbHide )
I HAVE TESTED BOTH OF THEM AND WORK PERFECT
USING THE FIRST WAY FROM AN ACCESS 97 MDB PRINT ABOUT 600
LINES EVERY DAY FOR 6 YEARS WITH NO PROBLEM
HOPE TO HELP YOU
GNIKOL

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top