Home All Groups Group Topic Archive Search About

Open and print web document

Author
3 Feb 2006 11:28 AM
Wendy
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

Author
3 Feb 2006 3:27 PM
Armin Zingler
Show quote Hide quote
"Wendy" <We***@discussions.microsoft.com> schrieb
> 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