Solved

Remote printing with VB5

Posted on 1998-04-21
6
192 Views
Last Modified: 2008-03-06
I have a PCL file : test.prn.
I have a printer remotely connected : HP LaserJet 5 on SRV02 (\\SRV02\HP LaserJet 5).

I want to do 2 things :

1. A list of printers on the computer with the network path for remote printers.

For example :

HP LaserJet 4
HP LaserJet 5 - \\SRV02\HP LaserJet 5

2. I want to send the file to the printer.

How can I do ? I've tried with OpenPrinter, AddJob, ScheduleJob but AddJob doesn't work for remote printers.
I have had some problems with the types used bye these functions.

Can someone give me some code samples ?

If the answer is too long, e-mail me at greisch@euronet.be.

Patrick Vanhuyse
0
Comment
Question by:greisch
[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
  • 3
  • 3
6 Comments
 
LVL 3

Author Comment

by:greisch
ID: 1426107
Adjusted points to 150
0
 

Expert Comment

by:duc
ID: 1426108
Question 1
Sub main()
Dim X As Printer
For Each X In Printers
    Debug.Print X.DeviceName
    Set Printer = X
Next
End Sub

Duc

0
 
LVL 3

Author Comment

by:greisch
ID: 1426109
Hello Duc,

You get only the LOCAL device name (HP LaserJet 5), not the remote path to the device (\\SRV02\HP LaserJet 5).

Thanks.

Pat
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Expert Comment

by:duc
ID: 1426110
Hi Pat
In our installation it gives me the following

\\ZHSV57204\L4_ZF104
\\ZHSV57204\L4_ZF122

so it seems not to be a VB issue.

Regards
duc

0
 

Accepted Solution

by:
duc earned 150 total points
ID: 1426111
Hi Pat
I have a solution which works, not very sophisticated but... here the code:
Sub main()
  CheckFile = Dir("C:\PRINT.BAT")
  If CheckFile <> "" Then
   Kill "C:\PRINT.BAT"
  End If
  RetVal = Shell("notepad.exe", 1)
  SendKeys "C:\WINNT\SYSTEM32\print /d:\\ZHSV57204\L4_ZF122 C:\test.prn", True
  SendKeys "{ENTER}"
  SendKeys "%{F4}", True
  SendKeys "{ENTER}", True
  SendKeys "C:\PRINT.BAT", True
  SendKeys "{ENTER}", True
 
  RetVal = Shell("C:\PRINT.BAT", 0)
 
End Sub
0
 
LVL 3

Author Comment

by:greisch
ID: 1426112
Hi Duc,

You were right for the question 1.

When I test it, I was on the server !!!

Sorry.

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

691 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