Solved

Printing a file in several printers connected in WAN!

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…

728 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