Solved

printing to a remote printer

Posted on 2003-11-19
7
236 Views
Last Modified: 2010-05-03
i am writing an application which requires me to print to a dot matrix printer

hence to print i wrote the following code

Open "\\Node1\Epson" For Output As #1
Print #1, "Text to be printed "
Close #1


now, we have two machine node1 and node2 the printer is physially attached to node1 and the share name of the printer is Epson, when i run my application on node2 the print output is perfect with no errors

but when i try to print from node1 itself i get the following error
Run time error "52"
Bad file name or number

can some one help me with the problem

0
Comment
Question by:alifyusuf
[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
  • 2
7 Comments
 
LVL 3

Expert Comment

by:ToolMan
ID: 9786030
Hi,
Maybe the second node can't be resolved by your operatingsystem,
you should be able to ping your nodes and see whether you can print from e.g. notepad.

regards
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9786239
I think you'll have to use the printer object.

0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 150 total points
ID: 9786450
If you do have to use the printer object, you can do it like this.

It might be worth trying, even if you don't plan to use it in the long run, because you might get a different and more informative error message.

The printers must set up on your workstation with different names, e.g. Epson1 & Epson2

Dim prn As Printer

'Find the printer by name
For Each prn In Printers
  If prn.DeviceName = ("Epson1") Then
    Exit For
  End If
Next prn

'Set the printer object
Set Printer = prn

Printer.Print "Text to be printed"
Printer.NewPage
Printer.EndDoc
0
 
LVL 28

Assisted Solution

by:vinnyd79
vinnyd79 earned 150 total points
ID: 9788530
Have you tried this on Node1:

Open "LPT1" For Output As #1
Print #1, "Text to be printed "
Close #1


0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

739 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