473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to print multiple word documents via vb.net

I'd like to be able to print multiple documents are once using vb.net.
What is the best way to do this with out having to print each document
one at a time via a loop [calling
Word.PrintOut(fileName:=(OutputFileLocation & fileName)].

Can't I send them all to a spool at once or something?

Ideally, I would like the code such that multiple users can print via
my application at the same time.

Any help would be appreciated. Thanks

8957078

PS

Someone suggested merging the docs into one programatically but i'm
not sure if that would solve the problem i'm having with the printing
getting locked up when users try to print at the same time.

If this is a good idea, does anyone have any examples?
Jul 21 '05 #1
3 13796
Hi 8957078,

Unusual handle you've got there! ;-)

I think <your program> is going to have to be that spooler.

What's the objection to looping through your Word.Prints? If it's because
your app can't do anything until all the printing is done, then I would
suggest learning just how easy** it can be to do it in a separate Thread.

When you say 'multiple users ... at the same time', what do you mean,
exactly?

Regards,
Fergus

** 'easy' - a relative term, but I would hope that you'd be nicely surprised.
:-)
Jul 21 '05 #2
Below is my code. The object I loop through is an array of documents
data (holds paths and filenames of docs to be printed).

I'm using InterOp. It seems to lock up and never print if two or more
users try to print the same documents.

In any case, do you have an example of doing the multi thread for this
situation?
Thanks for your input.

8957078
----------------------------------------------------------------
Try
MergeDocumentAndPrint(documents, aDocumentInformation)

''Original Code Below
'If Not documents Is Nothing AndAlso documents.Count > 0
Then
' m_Word = CreateObject("Word.Application")
'Start Word and open the document template.
' m_Word.Visible = False
'Have Word run in background

' We have some files, Print Them
For Each aDocumentInformation In documents
If Not
aDocumentInformation.EndorsementLongDescription = (New
BOConstants).QUOTE_SHEET_NAME Then

Me.PrintDocument(aDocumentInformation.FileName)
End If
Next
Me.CloseWinWord() 'Clean Up
End If
Catch ex As Exception
Me.CloseWinWord()
Me.CreatePrintingException("The following error received
while attempting to print a document: " & _
ex.ToString)
End Try
----------------------------------------------------------------

"Fergus Cooney" <fi******@tesco.net> wrote in message news:<#e**************@TK2MSFTNGP10.phx.gbl>...
Hi 8957078,

Unusual handle you've got there! ;-)

I think <your program> is going to have to be that spooler.

What's the objection to looping through your Word.Prints? If it's because
your app can't do anything until all the printing is done, then I would
suggest learning just how easy** it can be to do it in a separate Thread.

When you say 'multiple users ... at the same time', what do you mean,
exactly?

Regards,
Fergus

** 'easy' - a relative term, but I would hope that you'd be nicely surprised.
:-)

Jul 21 '05 #3
Hi SpamProof,
I'm using InterOp. It seems to lock up and never print if two or more
users try to print the same documents.

The problem you're running into is inherent to Word: Word puts a file
lock on opened documents because it doesn't support any kind of file
sharing.

My suggestion would be to have your program create a COPY of the
document (at the file level), open that, print it. And when the print
process is finished, delete all the copies.

-- Cindy

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: philipl | last post by:
hi, I have a program which waits for batches documents to be dropped into a folder, once this happens, a class which activates the word object is instaniated per batchg of docs & a number of...
1
by: achintya.jha | last post by:
Hi, I am currently working hard to print Word labels from ASP.NET I have multiple records which I need to print on to a word label print functionality. I know that Word Label printing prints...
3
by: SpamProof | last post by:
I'd like to be able to print multiple documents are once using vb.net. What is the best way to do this with out having to print each document one at a time via a loop . Can't I send them all to...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
3
by: siddhi | last post by:
Hi, I am very very new to vb6. I am trying to browse and read multiple microsoft word files. i am able to do for one file as follow, but not multiple files. Please I need help ASAP. Thanks Private...
2
by: westmids | last post by:
I'm not sure that what I want to do is possible with Access 97, but I hope to be proved wrong: Within Access 97 I have a table with a hyperlink field enabling me to open MS Word 97 documents. At...
1
by: kirkus84 | last post by:
I am currently trying to do a multiple record mail merge through a query via a command button on a form. The query basically displays customers who have said yes to privacy. The user inputs a date...
0
Pittaman
by: Pittaman | last post by:
Hello, We're developing an application (.NET 2.0) that let's users drop documents in the application and allows users to show some document types "embedded". For example, a textfile would appear...
0
by: shivapadma | last post by:
i want to know how multiple tables are added to the MS word document using vb.net i wrote following code to insert one table in MS word document using vb.net 1.opened MS word document 2.inserted...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.