Question : VB6: Printing HTML file on single page

Our VB6 application creates an HTML file for printing, and for emailing. Everything is working perfectly. Except, of course, the printout goes to a second page. The text is only a few lines and a small graphic... This is the line we use to print.

ShellExecute handle, "PRINT", app.Path & "\rc.htm", "", "", SW_HIDE

Is there a parameter that can be set to force the page to render to a single sheet of paper?

Answer : VB6: Printing HTML file on single page

Use webbrowser control instead
WB.Visible=False
WB.Navigate app.Path & "\rc.htm"
Do while WB.ReadyState<4
   DoEvents
Loop
'Or even better - without file:
'WB.Navigate "about.blank"
'Do whilw WB.ReadyState<4
  ' DoEvents
'Loop
'WB.Document.body.innerHtml=YourFormattedHtmlString
WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
'OLECMDID_PRINT = 6
'OLECMDEXECOPT_DONTPROMPTUSER = 2
'OLECMDEXECOPT_PROMPTUSER = 1

Random Solutions  
 
programming4us programming4us