I would be grateful for any help on the following printing query.
I am trying to print plain text reports, pre-formatted within the program, to a network
printer (Epson SQ1170) in draft mode without using the Windows printing system, by opening
and printing to the print queue as a device. I would prefer not to have to send the data
to a file and then print the file.
The following PB/DLL 6 code will not work at all using a network printer but work perfectly
well using LPT1 with the printer locally attached to the parallel port.
The Visual Basic 6 code however, works perfectly without any problems so am I missing
something here - maybe a missing include file - as there is obviously something in
Visual Basic which is not in PB/DLL?
I have searched through all the back archives in the forums, and it seems that the
code is correct.
I apologise in advance if this has been fully covered and I have missed it, but if
anyone has any suggestions I would be very grateful, as, for printing this type
of report, I would like to keep it as simple as possible without getting into full
Windows printing methods at the moment. I have found numerous code examples, but they
all seem much too complex for what I am trying to achieve.
'... VISUAL BASIC 6 CODE ...
Option Explicit
Private Sub Form_Load()
Dim i As Long
Dim strDistribution As String
strDistribution = "CW,CF,HE,NG,BL,BF,JK,RC"
Open "\\BATH_PRESS\COMPUTERQ0" For Output As #1
' Open "LPT1" For Output As #1
Print #1, "Date produced: " & _
"BATH PRESS LTD. : DEPARTMENTAL V.O.P REPORT"
Print #1,
Print #1, "NUMBER OF DAYS = 5"
Print #1,
Print #1, " DEPARTMENT"
Print #1, " " & _
"Hours V.O.P. Hours V.O.P. " & _
"Hours V.O.P."
Print #1, " " & _
"|---------------------------|-----------|-------------" & _
"|-----------|-------------|-----------|"
Print #1,
Print #1, "Distribution: " & strDistribution
For i = 1 To 50
Print #1, i
Next i
Print #1, Chr$(12)
Close #1
End Sub
------------------
I am trying to print plain text reports, pre-formatted within the program, to a network
printer (Epson SQ1170) in draft mode without using the Windows printing system, by opening
and printing to the print queue as a device. I would prefer not to have to send the data
to a file and then print the file.
The following PB/DLL 6 code will not work at all using a network printer but work perfectly
well using LPT1 with the printer locally attached to the parallel port.
The Visual Basic 6 code however, works perfectly without any problems so am I missing
something here - maybe a missing include file - as there is obviously something in
Visual Basic which is not in PB/DLL?
I have searched through all the back archives in the forums, and it seems that the
code is correct.
I apologise in advance if this has been fully covered and I have missed it, but if
anyone has any suggestions I would be very grateful, as, for printing this type
of report, I would like to keep it as simple as possible without getting into full
Windows printing methods at the moment. I have found numerous code examples, but they
all seem much too complex for what I am trying to achieve.
Code:
'============================================================== '... PB/DLL 6 CODE ... #Dim All #Register None #Compile Exe #Include"WIN32API.INC" #Include"COMMCTRL.INC" #Include"COMDLG32.INC" Function PbMain() As Long Dim i As Long Dim strDistribution As String strDistribution = "CW,CF,HE,NG,BL,BF,JK,RC" Open "\\BATH_PRESS\COMPUTERQ0" For Output As #1 ' OPEN "LPT1:" FOR OUTPUT AS #1 Print #1, "Date produced: " & _ "BATH PRESS LTD. : DEPARTMENTAL V.O.P REPORT" Print #1, Print #1, "NUMBER OF DAYS = 5 Print #1, Print #1, " DEPARTMENT" Print #1, " " & _ "Hours V.O.P. Hours V.O.P. " & _ "Hours V.O.P." Print #1, " " & _ "|---------------------------|-----------|-------------" & _ "|-----------|-------------|-----------|" Print #1, Print #1, strDistribution For i = 1 To 50 Print #1, i Next i PRINT #1, CHR$(12) Close #1 End Function '=========================================================================
Option Explicit
Private Sub Form_Load()
Dim i As Long
Dim strDistribution As String
strDistribution = "CW,CF,HE,NG,BL,BF,JK,RC"
Open "\\BATH_PRESS\COMPUTERQ0" For Output As #1
' Open "LPT1" For Output As #1
Print #1, "Date produced: " & _
"BATH PRESS LTD. : DEPARTMENTAL V.O.P REPORT"
Print #1,
Print #1, "NUMBER OF DAYS = 5"
Print #1,
Print #1, " DEPARTMENT"
Print #1, " " & _
"Hours V.O.P. Hours V.O.P. " & _
"Hours V.O.P."
Print #1, " " & _
"|---------------------------|-----------|-------------" & _
"|-----------|-------------|-----------|"
Print #1,
Print #1, "Distribution: " & strDistribution
For i = 1 To 50
Print #1, i
Next i
Print #1, Chr$(12)
Close #1
End Sub
------------------
Comment