PrintHTMLFile Method

Top  Previous  Next

Prints an HTML (Hypertext Markup Language) document from an HTML file (*.htm, *.html). This method prints the document immediately using your existing web browser printing features (without launching the web browser). There is no need to use any of the control properties. See remarks below.



Where object evaluates to a Smart Print Control.

The PrintHTMLFile method has these arguments:


HTMLFileNameString expression specifying the fully qualified file name of the HTML file to print.  


This method enables you to print an HTML document form an HTML file using your web browser printing capabilities. The file will be printed exactly as you see it in your web browser, including any images that may appear in the HTML document. There is no need to set or use any of the Smart Print Control properties.

The following code line shows how to use this method to print an HTML document from an HTML file:

   SPrinter1.PrintHTMLFile "C:\MyHTMLFile.HTM"

Note that by using this method, all control properties are ignored, whether set (or not) before calling this method. Also, setting the printer using the SetPrinter method will have no effect. The printer specified by your web browser "Print Setup" will be used.

Note that if you have no web browser installed on your system, the PrintHTMLFile method will fail.

When you use this method to print an HTML file, the Windows Print Dialog will be displayed before sending the document to the printer.