There is a way for printing multiple Word document at once via VB.NET code ?
I did not find any solution for this kind of job!
Thanks in advice!
Printable View
There is a way for printing multiple Word document at once via VB.NET code ?
I did not find any solution for this kind of job!
Thanks in advice!
You might be better off posting this in the Office section of these forums ;)
http://www.vbforums.com/forumdisplay.php?f=37
But yeah, what code have you got so far? If you can print one document then you could just use some additional threads (either manually creating Threading.Thread instances or using the ThreadPool class) to do the same thing but for different documents. These threads could all run at the same time so should do what you want.
this is my code so far....Code:Dim WordApp As Microsoft.Office.Interop.Word.Application
Dim MyDoc As String = frm_eliberare_cdm.cale_imprimare
'init word object
WordApp = New Microsoft.Office.Interop.Word.Application
'show word
WordApp.Application.Visible = True
'open word file
WordApp.Documents.Open(MyDoc)
'printpreview
WordApp.PrintPreview = True
'print to printer
'WordApp.PrintOut()
I think this code will blow up the computer!
So what happens when you run that code?
For a single document is not happening but if i have 100 or more the if i use
"For each ..." statement will blow or not ?
So it works fine for one document yes?
Yes it works very well for a single document!
But in my opinion it will not work as well for more than 5 documents... ?
(for the app working on minimum PIII 800 MHz, 512 Mb RAM, XP, Word 2007)
Isn't ?
Well like I said, you could try using the ThreadPool class to create new thread objects that run this code. I dont know how well it would work though to be honest, as you could potentially end up with an awful lot of word.exe processes open... but do a bit of reading up on the ThreadPool class and background/multi -threading.
http://msdn.microsoft.com/en-us/libr...threading.aspx
OK! I'll try to do it like you said. I'll return on this post with some mori info! Thanks.
To save on performance, only create the word application once, and reuse it in the loop.
The launching of Word is a fairly slow process, so if you only do that once, you will save a lot of time.
One thing you need to be aware of with printing 100 documents like this is that each document is sent separately, so if users are using a network printer, there is nothing to stop someone else from printing a document in the middle of these 100 that are printing. With that many documents, one small document would probably get lost in the paper.
This seems to be a quick code but give's me the error: "No application is associated with the specified file for this operation".Quote:
Originally Posted by RobDog888
The word file has now the extension ".mbm" but is associated with MS Word 2003.
What can i do in this case ?!
Start a process on "winword.exe" (include the path possiblly) and pass the complete filepath to the *.mbm file.