Click to See Complete Forum and Search --> : Writing and Printing from a File


gknierim
March 22nd, 2001, 12:25 PM
I would like to generate a HTML file based on data I retrieve from the database. I want to be able to write the file, save the file, and print the file automatically with no user intervention. Can anyone give me a clue as to how to write the HTML file and then automatically print it?

Many thanks for any suggestions!
Greg

Iouri
March 22nd, 2001, 01:10 PM
Open "c:\temp\temp.html" For Output As #1 'to write to
Print #1, YourString
Close #1


'to print

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Dim lngResult As Long
lngResult = ShellExecute(Me.hwnd,"Print",strFile,0&,0&,vbMinimized)

where strFile is the full path to your file





Iouri Boutchkine
iouri@hotsheet.com

gknierim
March 22nd, 2001, 02:24 PM
Ok, thats fine but it brings up the printer box and requires the user to select a printer and to click the OK button. I need a way to print the file without the user to click OK.

Thanks,
Greg

Iouri
March 22nd, 2001, 02:54 PM
Open "c:\temp\temp.html" For Input As #1 'to read from
Do While Not EOF(1)
Line Input #1, sLine
Printer.Print sLine
Loop
Close #1


Iouri Boutchkine
iouri@hotsheet.com

gknierim
March 22nd, 2001, 04:09 PM
Won't this print the actual HTML text and not the processed HTML??

dpws
July 30th, 2001, 12:17 AM
Have a look at

http://msdn.microsoft.com/library/en-us/dnie55/html/wb_print.asp