By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

printing external document possible??

P: n/a
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!
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
ShellExecute with Print Command/verb

--
Regards,
Anand M
VB.NET MVP

http://www.dotnetindia.com
"Leo" wrote:
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!

Nov 20 '05 #2

P: n/a
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
-----Original Message-----
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 orwhatever) 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 thesystem, 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!
.

Nov 20 '05 #3

P: n/a
* "Leo" <lp***@cistron.nl> scripsit:
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)
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

P: n/a
Leo
Thank you!!! It works!!!
Leo

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:2g************@uni-berlin.de...
* "Leo" <lp***@cistron.nl> scripsit:
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)
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.