ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy to netprinter (https://www.excelbanter.com/excel-programming/364623-copy-netprinter.html)

Leif Rasmussen[_2_]

copy to netprinter
 
Hej
In VB or VBA I can send a string (containing special caracters for
generating a barcode label,eg ^XA,^FO140,^XZ etc) with a syntax like when the
printer is connected to LPT1:
MyString=^XA,^FO140,^XZ
Open LPT1 For Output As #1
Print #1, MyString
Close #1
I Have problems with a sending the same to fx "Zebra TLP 2844 on Ne00" (the
printercollection gives the devicename and port in VB)
Can somebody give a hint ??
Best regards
Leif Rasmussen

Tom Ogilvy

copy to netprinter
 
This is the form I have used previously and it worked for me:

I used the first part of the result of ActivePrinter when that printer was
selected.

Sub Macro5()
Dim ctrl As Long
Dim tmpstr As String
Open "\\ARDAPS01\1D343E" For Output As #1
Print #1, "[Start of Printing Test]"
For ctrl = 1 To 10
tmpstr = "Printing Line " + Str(ctrl)
Print #1, tmpstr
Next
tmpstr = "[End of printing test]" + Chr(12)
Print #1, tmpstr
Close #1
End Sub

--
Regards,
Tom Ogilvy

"Leif Rasmussen" wrote in message
...
Hej
In VB or VBA I can send a string (containing special caracters for
generating a barcode label,eg ^XA,^FO140,^XZ etc) with a syntax like when

the
printer is connected to LPT1:
MyString=^XA,^FO140,^XZ
Open LPT1 For Output As #1
Print #1, MyString
Close #1
I Have problems with a sending the same to fx "Zebra TLP 2844 on Ne00"

(the
printercollection gives the devicename and port in VB)
Can somebody give a hint ??
Best regards
Leif Rasmussen




Leif Rasmussen[_2_]

copy to netprinter
 
Hej again
I dont understand "the first part of the result of ActivePrinter" I my
application ActivePrinter returns "Zebra TLP2844-Z on Ne04:" and if I write
Open "\\Zebra TLP2844-Z" for output As#1
I get an error. What have I not understud ???

"Tom Ogilvy" wrote:

This is the form I have used previously and it worked for me:

I used the first part of the result of ActivePrinter when that printer was
selected.

Sub Macro5()
Dim ctrl As Long
Dim tmpstr As String
Open "\\ARDAPS01\1D343E" For Output As #1
Print #1, "[Start of Printing Test]"
For ctrl = 1 To 10
tmpstr = "Printing Line " + Str(ctrl)
Print #1, tmpstr
Next
tmpstr = "[End of printing test]" + Chr(12)
Print #1, tmpstr
Close #1
End Sub

--
Regards,
Tom Ogilvy

"Leif Rasmussen" wrote in message
...
Hej
In VB or VBA I can send a string (containing special caracters for
generating a barcode label,eg ^XA,^FO140,^XZ etc) with a syntax like when

the
printer is connected to LPT1:
MyString=^XA,^FO140,^XZ
Open LPT1 For Output As #1
Print #1, MyString
Close #1
I Have problems with a sending the same to fx "Zebra TLP 2844 on Ne00"

(the
printercollection gives the devicename and port in VB)
Can somebody give a hint ??
Best regards
Leif Rasmussen





Tom Ogilvy

copy to netprinter
 
Perhaps it is just in the email and your code is correct, but

Open "\\Zebra TLP2844-Z" for output As#1


shows As#1 instead of As #1

My Activerpinter returned the \\ also, so what you are getting might be some
form of name rather than that actual address. You might need to find the
actual address of the printer - what I was telling you is that if you get an
equivalent network name, the command should work.

--
Regards,
Tom Ogilvy



"Leif Rasmussen" wrote in message
...
Hej again
I dont understand "the first part of the result of ActivePrinter" I my
application ActivePrinter returns "Zebra TLP2844-Z on Ne04:" and if I

write
Open "\\Zebra TLP2844-Z" for output As#1
I get an error. What have I not understud ???

"Tom Ogilvy" wrote:

This is the form I have used previously and it worked for me:

I used the first part of the result of ActivePrinter when that printer

was
selected.

Sub Macro5()
Dim ctrl As Long
Dim tmpstr As String
Open "\\ARDAPS01\1D343E" For Output As #1
Print #1, "[Start of Printing Test]"
For ctrl = 1 To 10
tmpstr = "Printing Line " + Str(ctrl)
Print #1, tmpstr
Next
tmpstr = "[End of printing test]" + Chr(12)
Print #1, tmpstr
Close #1
End Sub

--
Regards,
Tom Ogilvy

"Leif Rasmussen" wrote in

message
...
Hej
In VB or VBA I can send a string (containing special caracters for
generating a barcode label,eg ^XA,^FO140,^XZ etc) with a syntax like

when
the
printer is connected to LPT1:
MyString=^XA,^FO140,^XZ
Open LPT1 For Output As #1
Print #1, MyString
Close #1
I Have problems with a sending the same to fx "Zebra TLP 2844 on Ne00"

(the
printercollection gives the devicename and port in VB)
Can somebody give a hint ??
Best regards
Leif Rasmussen








All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com