Private Sub PrintHtmlFile(cHtmlFile As String)
Dim hProcess As Long
Dim ProcessId As Long
Dim ExitCode As Long
Dim cWinSysDir As String
cWinSysDir = String(254, " ")
Call GetSystemDirectory(cWinSysDir, Len(cWinSysDir))
cWinSysDir = Trim(Left(cWinSysDir, InStr(cWinSysDir, Chr(0)) - 1))
If Dir(cWinSysDir & "\MSHTML.DLL") <> "" Then
ProcessId = Shell("rundll32.exe " & cWinSysDir & "\MSHTML.DLL,PrintHTML " & Chr(34) & cHtmlFile & Chr(34), vbNormalFocus)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
Do
Call GetExitCodeProcess(hProcess, ExitCode)
DoEvents
Loop While ExitCode = STATUS_PENDING
Call CloseHandle(hProcess)
End If
End Sub