![]() |
printing a html file progra
Hi
I'm using Office '03. I've a couple of Q's regarding printing... I've written a routine that copies the code from the vbe & converts it t o html. I've then saved it to a file (test.htm). 1. What's the best way to print this file? I've found this routine that loads it into an IE object: Sub PrintHtml(fileName) Dim objIE Set objIE = wscript.CreateObject("InternetExplorer.Application ", "ie_") objIE.Visible = True objIE.Navigate fileName Do Until objIE.readyState = 4: wscript.sleep 20: Loop print_done = False ' 6 = PRINT, 2 = NO USER PROMPT objIE.ExecWB 6, 2 ' Wait until printing id done. Do While Not print_done: wscript.sleep 50: Loop objIE.Quit End Sub I've never used ExecWB before. Is this the best way? Is there a way to print the output of the file (not the source code) without saving it to disk? 2. When printing is there a way to programmatically set the printer driver properties. Specifically the option to print 2 pages on 1 sheet. I'm guessing the drivers are manufacturer specific & have no idea how to do this. Your help would be much appreciated. Cheers Dave F. Please note the email is cross posted to relevant multiple NG's to obtain the quickest,most accurate answer. |
printing a html file programmatically
Sorry that header should read as above
Dave F. wrote: Hi I'm using Office '03. I've a couple of Q's regarding printing... I've written a routine that copies the code from the vbe & converts it t o html. I've then saved it to a file (test.htm). 1. What's the best way to print this file? I've found this routine that loads it into an IE object: Sub PrintHtml(fileName) Dim objIE Set objIE = wscript.CreateObject("InternetExplorer.Application ", "ie_") objIE.Visible = True objIE.Navigate fileName Do Until objIE.readyState = 4: wscript.sleep 20: Loop print_done = False ' 6 = PRINT, 2 = NO USER PROMPT objIE.ExecWB 6, 2 ' Wait until printing id done. Do While Not print_done: wscript.sleep 50: Loop objIE.Quit End Sub I've never used ExecWB before. Is this the best way? Is there a way to print the output of the file (not the source code) without saving it to disk? 2. When printing is there a way to programmatically set the printer driver properties. Specifically the option to print 2 pages on 1 sheet. I'm guessing the drivers are manufacturer specific & have no idea how to do this. Your help would be much appreciated. Cheers Dave F. Please note the email is cross posted to relevant multiple NG's to obtain the quickest,most accurate answer. |
printing a html file programmatically
I think you might get additional advice asking in the VS2005 groups and
places like http://www.codeproject.com/ in case someone has already tried the same idea. Even if they used a different "Language" you may get some good clues. Sorry not to be more directly helpful but I think you may be right about some drivers being specific. "Dave F." wrote in message ... Sorry that header should read as above Dave F. wrote: Hi I'm using Office '03. I've a couple of Q's regarding printing... I've written a routine that copies the code from the vbe & converts it t o html. I've then saved it to a file (test.htm). 1. What's the best way to print this file? I've found this routine that loads it into an IE object: Sub PrintHtml(fileName) Dim objIE Set objIE = wscript.CreateObject("InternetExplorer.Application ", "ie_") objIE.Visible = True objIE.Navigate fileName Do Until objIE.readyState = 4: wscript.sleep 20: Loop print_done = False ' 6 = PRINT, 2 = NO USER PROMPT objIE.ExecWB 6, 2 ' Wait until printing id done. Do While Not print_done: wscript.sleep 50: Loop objIE.Quit End Sub I've never used ExecWB before. Is this the best way? Is there a way to print the output of the file (not the source code) without saving it to disk? 2. When printing is there a way to programmatically set the printer driver properties. Specifically the option to print 2 pages on 1 sheet. I'm guessing the drivers are manufacturer specific & have no idea how to do this. Your help would be much appreciated. Cheers Dave F. Please note the email is cross posted to relevant multiple NG's to obtain the quickest,most accurate answer. |
All times are GMT +1. The time now is 10:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com