Solved

Printing a file in several printers connected in WAN!

Posted on 2002-06-25
3
125 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 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