Good evening all,
I am trying to print from a web site that I have open. It prints just fine when I step through it, but when it runs it prints nothing. I have put a sleep sub to slow it down and that doesn't work. I have gone back to the do events. it does work if I display a message box for a user to click on. Please help. My code is as followings:
I am trying to print from a web site that I have open. It prints just fine when I step through it, but when it runs it prints nothing. I have put a sleep sub to slow it down and that doesn't work. I have gone back to the do events. it does work if I display a message box for a user to click on. Please help. My code is as followings:
Code:
Function PrintWebSite(WebPage As String)
Dim ie As Object
Dim intwidth As Integer
Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_PROMPTUSER = 1
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
******"I would like to use this but can't figure it out"************
'Const OLECMDEXECOPT_PRINT_WAITFORCOMPLETION
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate WebPage
Do Until ie.busy = False
DoEvents
Loop
'Send Data to IE
'Prints without showing the user that the browser is open.
ie.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
Do While ie.readystate <> 4
DoEvents
Loop
'Giving it time to print
ie.Quit
Set ie = Nothing
End Function
Last edited by a moderator: