printing external document possible??

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!
 
J

Jorge

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
 
H

Herfried K. Wagner [MVP]

* "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)
///
 
L

Leo

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)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top