Open and print web document

G

Guest

I read Herfried Wagner's code from 12/05. I can get the following to work to
open a web page:
Dim psi As New ProcessStartInfo()
With psi
.FileName = "iexplore"
.Arguments = "-new http://dotnet.mvps.org/"
End With
Process.Start(psi)

Next, I need to be able to print the web page that is opened programatically
and hidden from the user. So I tried this, but it errors every time:
Dim psi As New ProcessStartInfo()
With psi
.Verb = "print"
.WindowStyle = ProcessWindowStyle.Hidden
.FileName = "iexplore"
.Arguments = "-new http://dotnet.mvps.org/"
.UseShellExecute = True
End With
Process.Start(psi)

The error I receive is:
An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in system.dll
Additional information: No application is associated with the specified file
for this operation.

Please help!

Thank you,

Wendy
 
A

Armin Zingler

Wendy said:
I read Herfried Wagner's code from 12/05. I can get the following
to work to open a web page:
Dim psi As New ProcessStartInfo()
With psi
.FileName = "iexplore"
.Arguments = "-new http://dotnet.mvps.org/"
End With
Process.Start(psi)

Next, I need to be able to print the web page that is opened
programatically and hidden from the user. So I tried this, but it
errors every time: Dim psi As New ProcessStartInfo()
With psi
.Verb = "print"
.WindowStyle = ProcessWindowStyle.Hidden
.FileName = "iexplore"
.Arguments = "-new http://dotnet.mvps.org/"
.UseShellExecute = True
End With
Process.Start(psi)

The error I receive is:
An unhandled exception of type
'System.ComponentModel.Win32Exception' occurred in system.dll
Additional information: No application is associated with the
specified file for this operation.


Verb "print" requires a file to print. You can not print "iexplore.exe".
Sorry, I don't hve a solution.


Armin
 

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