Croeg
12-24-2006, 08:38 AM
Hi all,
Not sure if this is possible but the code below pulls up a webpage, waits for it to load, prints it...allowing enough time for info to reach the printer before closing down IE. I am trying to force the printer to switch to landscape but not sure if/how this can be done.
Any Ideas ??? :help
Croeg
Sub test()
Dim IeApp As InternetExplorer
Dim sURL As String
Dim IeDoc As Object
Dim i As Long
'Create new instance of IE
Set IeApp = New InternetExplorer
'Make it visible - some things don?t work
'unless it?s visible
IeApp.Visible = True
On Error GoTo EndPrint
sURL = www.cvbaexpress.com (http://www.cvbaexpress.com/)
'navigate to the page
IeApp.navigate sURL
'Pause the macro using a loop until the
'page is fully loaded
Do
Loop Until IeApp.ReadyState = READYSTATE_COMPLETE
Const PRINT_WAITFORCOMPLETION = 2
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Const OLECMDID_PRINT = 6
IeApp.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, PRINT_WAITFORCOMPLETION, 2
'Clean up
IeApp.Quit
Set IeApp = Nothing
Exit Sub
EndPrint:
'IF WEBSITE NOT RESPONDING
ans = MsgBox("Website not responding.", vbOKOnly)
VRFYSYS.Show
End Sub
Not sure if this is possible but the code below pulls up a webpage, waits for it to load, prints it...allowing enough time for info to reach the printer before closing down IE. I am trying to force the printer to switch to landscape but not sure if/how this can be done.
Any Ideas ??? :help
Croeg
Sub test()
Dim IeApp As InternetExplorer
Dim sURL As String
Dim IeDoc As Object
Dim i As Long
'Create new instance of IE
Set IeApp = New InternetExplorer
'Make it visible - some things don?t work
'unless it?s visible
IeApp.Visible = True
On Error GoTo EndPrint
sURL = www.cvbaexpress.com (http://www.cvbaexpress.com/)
'navigate to the page
IeApp.navigate sURL
'Pause the macro using a loop until the
'page is fully loaded
Do
Loop Until IeApp.ReadyState = READYSTATE_COMPLETE
Const PRINT_WAITFORCOMPLETION = 2
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Const OLECMDID_PRINT = 6
IeApp.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, PRINT_WAITFORCOMPLETION, 2
'Clean up
IeApp.Quit
Set IeApp = Nothing
Exit Sub
EndPrint:
'IF WEBSITE NOT RESPONDING
ans = MsgBox("Website not responding.", vbOKOnly)
VRFYSYS.Show
End Sub