?
Solved

printing to a remote printer

Posted on 2003-11-19
7
Medium Priority
?
241 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 600 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 600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses

764 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