printing external document possible??

  • Thread starter Thread starter Leo
  • Start date Start date
L

Leo

Hi,

Does anyone know if it's possible to print an external document with vb.NET?

I want to create a function that needs a file name (*.doc, *.xls *.pdf or
whatever) and then print that document.
If you rightclick on a document in explorer there is also a print option.
And my function has to do exactly the same.

If you e.g. print an excel document, excel has to be installed on the
system, but that's no problem. On all computers where I run this function,
all common applications such as word, excel, adobe reader are installed.

Thanks in advance!
 
Hi Leo!

You can add a reference to excel and/or word in your
project.
Both Excel sheets and Word documents have the PrintOut
method.

Kind Regards
Jorge
 
* "Leo said:
Does anyone know if it's possible to print an external document with vb.NET?

I want to create a function that needs a file name (*.doc, *.xls *.pdf or
whatever) and then print that document.
If you rightclick on a document in explorer there is also a print option.

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.pdf"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///
 
Thank you!!! It works!!!
Leo

Herfried K. Wagner said:
option.

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.pdf"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///
 
Back
Top