[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Print a word document from VB DLL

I want to print a Microsoft word document containing only Times New roman font from the hard disk to the deafult printer using VB code. This code will be executed on the NT server where Microsoft Word will not be installed. Are there any APIs or Printer object functions available to do this thing?
     Do also write the code if possible.

Thanks in advance
0
vikramaraj
Asked:
vikramaraj
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
The only thing that can be done if Word isn't intalled on the computer, is to have a ready to print file (you have the "Print to file" option when you go to the print panel).
0
 
Jon_RaymondCommented:
If you can connect to another computer that does have word you could use a COM server written in VB to execute the Word processing from a VB client app on your NT server.
0
 
vikramarajAuthor Commented:
The NT Server will have access to only the printserver and no other machines. "emoreau" could you please elaborate on the solution once again and also how it can be achieved from VB code.

Maybe if no solution comes out then I can force the client to install Microsoft Word on NT server. Still is Word is installed can the document be printed directly to the printer spooler using COM objects?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Jon_RaymondCommented:
If you want to print a Word document I think at some point Word has to be opened and the document has to be printed from Word.  If you use emoreau's solution you would print to a file instead of a printer, and then send the file to the printer.
0
 
rondeaujCommented:
if you install word on the server you can use this code:

Create a ref to the excel object lib 8.0

Dim MyExcel as Excel.WorkSheet

set Myexcel = getobject(filename)
'this will not open the app

myexcel.print
0
 
vikramarajAuthor Commented:
Thanks rondeauj,
0
 
vikramarajAuthor Commented:
Thanks rondeauj,
This is what I was looking for and This solution work fine.
0
 
Éric MoreauSenior .Net ConsultantCommented:
You can now accept rondeauj's comment.
0
 
rondeaujCommented:
my answer
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now