Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

Problems when printing in 2 paralel automated word sessions.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rudy Van Eeckhout - 21 Sep 2006 07:52 GMT
Hello all,

  I do have several perl scrips whicht opens by ole an word instance
which is used to print a document to a certain printer.  Now we noted
that these documents sometimes appear on the wrong printer. After some
investiation is did seen next effect.
First assume next script

  my $Word= Win32::OLE->CreateObject('Word.Application', 'Quit');
  $openWord->{'Visible'} = 0;
  $Word->{ActivePrinter} = "$printer";
  <STDIN> ; #Wait for a cariage return
  print $Word->{ActivePrinter} ."\n" ;

When i run this script with $printer set to printerA and i do wait to
give a cariage return until i did run the script in a second form with
$printer set to printerB. The both script will print as active printer
printerB. This means that the assingment of Activeprinter is done for
all instances which are running.

Even when you try this manualy by opening 2 word sessions  you can see
that the printer changes over the different sessions.

If you start msword from the command line with the /w option the
problem disapears.
Now i can not find out how to do this over perl OLE.

Is there anybody who knows how to solve this over OLE?

  Kind regards.

   Rudy.
Cindy M. - 22 Sep 2006 08:41 GMT
Hi Rudy,

> When i run this script with $printer set to printerA and i do wait to
> give a cariage return until i did run the script in a second form with
> $printer set to printerB. The both script will print as active printer
> printerB. This means that the assingment of Activeprinter is done for
> all instances which are running.

Yes, changing the ActivePrinter in Word changes the default printer for
Windows, and will "of course" change the printer for all instances of
Word.

If you turn background printing in Word OFF
(Application.Options.PrintBackground = false) then all print jobs should
be processed synchronously, rather than asynchronously.

As I recall, there's also an old WordBasic command you can use to change
the printer that won't change the Windows default printer. Not sure how
using it will affect other Word documents, though. You should be able to
find the old WordBasic command in an article on word.mvps.org

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.