Solved

Printing a file in several printers connected in WAN!

Posted on 2002-06-25
3
124 Views
Last Modified: 2010-05-02
I want to print a Crystal report from VB. Actually what I want to do is that I got a few printers(say 5) connected to my server in WAN.Opening a Crystal report file in VB, I want to get the print of that file in all the printers at a time. Added info. is that I know the IP address and ports of those printers.
Please provide me any code to do this: whatever it may be!I will prefer a Macro!
Thanks for thinking about this problem.


Hi
I need to clarify a few things in your code:
Are you declaring an array arrPorts(1 to 3) of size 3
so instead of saying arrPorts(1 to 3) could i say
arrPorts(3)

I have defined all the 3 printers on the server.
so when I assign them to the array how should I do it
arrPorts(1) = "100.100.20.21:2004 LPT1:" ???
 when I try to run the program it says that p is an undefined variable.
Should I set it as a variant variable???

set Printer = defaultPrinter
This line of code has an error saying 'Type Mismatch'
And finally
when I run your code it doesnot even even go to the line
set Printer = p
Pliz help me out here.
Thanks in advance




0
Comment
Question by:mooni
3 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 7108693
i think something like this would work:

Dim defaultPrinter as Printer

set defaultPrinter = Printer

Dim arrPorts(1 to 3) as String

arrPorts(1) = "LPT1:"
arrPorts(2) = "LPT2:"
arrPorts(3) = "\\server\printer"

for each p in Printers
   for i = 1 to 3
      if p.port = arrPorts(i) then
          set Printer = p
          CrystalReport1.Destination = crptToPrinter
          CrystalReport1.PrintReport
          exit for
      end if
   next
next

set Printer = defaultPrinter

This is untested code, but basically what it does is changes your default printer to each of the specified printers at whatever ports you specify and then prints the report.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7963042
Hi mooni,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept bobbit31's comment(s) as an answer.

mooni, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8039088
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now