|
-
Jan 14th, 2009, 05:08 PM
#1
Thread Starter
Addicted Member
-
Jan 14th, 2009, 06:36 PM
#2
Re: [2008] Printing multiple Word documents
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.
-
Jan 14th, 2009, 06:54 PM
#3
Thread Starter
Addicted Member
Re: [2008] Printing multiple Word documents
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()
this is my code so far....
I think this code will blow up the computer!
I'm still learning VB.NET
Sorry for my bad english
Thanks for your help
-
Jan 14th, 2009, 06:59 PM
#4
Re: [2008] Printing multiple Word documents
So what happens when you run that code?
-
Jan 14th, 2009, 07:02 PM
#5
Thread Starter
Addicted Member
-
Jan 14th, 2009, 07:06 PM
#6
Re: [2008] Printing multiple Word documents
So it works fine for one document yes?
-
Jan 14th, 2009, 07:15 PM
#7
Thread Starter
Addicted Member
-
Jan 14th, 2009, 07:21 PM
#8
Re: [2008] Printing multiple Word documents
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
-
Jan 14th, 2009, 07:26 PM
#9
Thread Starter
Addicted Member
-
Jan 14th, 2009, 07:53 PM
#10
Re: [2008] Printing multiple Word documents
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.
-
Jan 14th, 2009, 10:11 PM
#11
Re: [2008] Printing multiple Word documents
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 19th, 2009, 05:13 PM
#12
Thread Starter
Addicted Member
Re: [2008] Printing multiple Word documents
 Originally Posted by RobDog888
This seems to be a quick code but give's me the error: "No application is associated with the specified file for this operation".
The word file has now the extension ".mbm" but is associated with MS Word 2003.
What can i do in this case ?!
I'm still learning VB.NET
Sorry for my bad english
Thanks for your help
-
Jan 19th, 2009, 08:39 PM
#13
Re: [2008] Printing multiple Word documents
Start a process on "winword.exe" (include the path possiblly) and pass the complete filepath to the *.mbm file.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|