Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Print HTML

8 views
Skip to first unread message

genojoe

unread,
Dec 23, 2005, 8:51:01 AM12/23/05
to
The following code prints a .DOC file to the default printer without
prompting for a printer. I would like to do the same for an HTML file.
Unfortunately when I insert an HTM file in this code, I always get a prompt.
Is there a solution for HTM files?

myProcess.StartInfo.FileName = "D:\Temp\This is a test.doc"
myProcess.StartInfo.Verb = "PrintTo"
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.UseShellExecute = True
myProcess.Start()
If myProcess.Responding Then
myProcess.CloseMainWindow()
Else
myProcess.Kill()
End If

Siva M

unread,
Dec 23, 2005, 10:23:56 AM12/23/05
to
This is because Internet Explorer is the default application to open HTML
files. If you want to use Word to open and print HTML files, try this:
Dim psi As System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo()

psi.Arguments = "<path to html file> /mFilePrintDefault /mFileExit"

psi.FileName = "winword.exe"

psi.CreateNoWindow = True

System.Diagnostics.Process.Start(psi)

However, this visibly opens Word application to do the operation.

HTH

"genojoe" <gen...@discussions.microsoft.com> wrote in message
news:D82962A6-B4F5-44AE...@microsoft.com...

0 new messages