473,748 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(f ileName:=(Outpu tFileLocation & 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 13827
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
MergeDocumentAn dPrint(document s, aDocumentInform ation)

''Original Code Below
'If Not documents Is Nothing AndAlso documents.Count > 0
Then
' m_Word = CreateObject("W ord.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 aDocumentInform ation In documents
If Not
aDocumentInform ation.Endorseme ntLongDescripti on = (New
BOConstants).QU OTE_SHEET_NAME Then

Me.PrintDocumen t(aDocumentInfo rmation.FileNam e)
End If
Next
Me.CloseWinWord () 'Clean Up
End If
Catch ex As Exception
Me.CloseWinWord ()
Me.CreatePrinti ngException("Th e following error received
while attempting to print a document: " & _
ex.ToString)
End Try
----------------------------------------------------------------

"Fergus Cooney" <fi******@tesco .net> wrote in message news:<#e******* *******@TK2MSFT NGP10.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
1582
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 things such as spellchecking grammer checking etc are done. When one batch(containing one or more docs) is dropped in, everything works fine, but when multple batches are dropped in(ie many classes of the same class are instaniated, weird things...
1
2458
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 the same label multiple times on the printer. I have to print multiple labels on to the same page and then the printer. So, I think I have to use Mail-Merge and then Word Label Print. I also need the standard label printing dialog to open before...
3
354
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 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
7
6246
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 user and populated (with info from an Access database) at run-time, then saved as Word documents. The program I have coded works fine -- it does what I need it to do. But it has two problems: (1) it runs very slowly, and (2) it does not seem to...
3
4851
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 Sub Process() On Error GoTo Err_Handle Dim i As Double Dim SRSWordStr As String Dim newStart As Double Dim tmpStrStart As Double Dim tmpStrEnd As Double Dim StopFinding As Boolean
2
8226
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 the end of each day I need to print all the Word documents in a specific order to mail out. Is it possible to automate this procedure in Access 97 so that the documents can all be printed at the touch of a button? This would save me hours of work,...
1
11494
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 into txtDate on frmDate and the clicks "View Queried Privacy Records" Once they click this it opens the query form frmPrivacy which then has a command button cmdMailmerge to perform the mail merge and print the records that result from that query. (I...
0
1393
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 as a text box. We also want this for office documents, and want to give the user the possibility to edit these documents inline, so they will not have to work in a separate excel window. We've been using the Webbrowser Control for this, but this...
0
5281
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 one 3x3 table Dim App As New Word.Application() Dim Doc As Word.Document = App.Documents.Add() Dim oTable1 As Word.Table Dim Range As Word.Range
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.