Open (printer) for output???

I have written a small vb6 program that writes to a special label printer that is directly connected to the user's parralel port "Lpt1". The program works just fine as follows:

Open "Lpt1" for Output as 1
Print #1, "Print line 1"
Print #1, "Print line 2"
Close #1

Now, however, the user is now asking to move the label printer to the network's file server so anyone can print to it. How do I change the Open command line to point to the Windows default printer instead of Lpt1?

1. Install the printer on the file server and share it
2. Come back to the client and install the printer
3. Check the printer properties and see what "port" is it connected to
4. Try printing to that port

If it is possible you will be successful. Othewise, leave behind this quick and dirty method and print using the standard windows method. That method will offer you many advantages, such as, spooling, backgroud printing, buffering etc etc.

RanjeetRain - I did that and it did not work. Additionally, each computer could use a separate port. Also, on a network you do not use ports off the local computer to direct the output to a printer.

Jenn3 - I did not follow what you are saying. Even if I get the name of the printer, how do I use it in the open and print commands. I already have tried substituting the network printer name and that does not work.

agj - Tried PRN and that does not work. Good idea though.

anv - I tried not specifing the printer and just printing, but nothing happened. Did not get an error, just nothing came out on the printer.

ajaypappan - Tried the like suggestion but did not work.

Any other ideas? I suspect the answer is really simple, just elusive. Thanks for the input. Please keep the suggestions coming.

I thought earlier that your suggestion would not work because nothing came out on my HP Laser Jet printer. But I think the reason why it did not come out was because the output went to memory and no page eject was sent. Since the label printer works differently (and has little to no memory), that may not be a problem.

I am sending the program over to the user to see how it works. This might work out just fine. I am going on vacation and probably won't be able to get back to you for a while so I just decided to award the answer to you now. When I find out, I will let you know.

Thanks for persevering and for the possible answer.

Regards,
EYoung

0

Featured Post

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Introduction
While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library. This article will introduce you to the SC library a…

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…

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…