![]() |
Macro to print web page and close browser
Hello, I would like to create a macro to open IE, navigate to a web page, print the page (3 copies) and close the browser. The folling code will navigate to the web page, but I can't figure out how to print the page. I believe I can close the browser with IEapp.quit Any help would be greatly appreciated. Thanks Oreg Sub getgeolink() Dim IeApp As InternetExplorer Dim sURL As String Dim IeDoc As Object Dim i As Long Set IeApp = New InternetExplorer IeApp.Visible = True sURL = "http://www.excelforum.com" IeApp.navigate sURL Do Loop Until IeApp.ReadyState = READYSTATE_COMPLETE Set IeApp = Nothing End Sub -- Oreg ------------------------------------------------------------------------ Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195 View this thread: http://www.excelforum.com/showthread...hreadid=530357 |
Macro to print web page and close browser
IeApp.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
Tim "Oreg" wrote in message ... Hello, I would like to create a macro to open IE, navigate to a web page, print the page (3 copies) and close the browser. The folling code will navigate to the web page, but I can't figure out how to print the page. I believe I can close the browser with IEapp.quit Any help would be greatly appreciated. Thanks Oreg Sub getgeolink() Dim IeApp As InternetExplorer Dim sURL As String Dim IeDoc As Object Dim i As Long Set IeApp = New InternetExplorer IeApp.Visible = True sURL = "http://www.excelforum.com" IeApp.navigate sURL Do Loop Until IeApp.ReadyState = READYSTATE_COMPLETE Set IeApp = Nothing End Sub -- Oreg ------------------------------------------------------------------------ Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195 View this thread: http://www.excelforum.com/showthread...hreadid=530357 |
Macro to print web page and close browser
Tim, Thanks for the help. I've encountered a script error and haven't been successful in figuring out what's wrong. here's the error: A run time error has occurred. Line 227 Error: 'dialogArguments._IE_PrintType' is null or not an object. My current OS is 2000. I've tried many suggestions via the web such as adding SYSTEM and INTERACTIVE to my default security permissions in DCOMCNFG.EXE and unchecking 3rd party browser extensions in internet options tab. Do you know where I'm going wrong? Thanks, Oreg -- Oreg ------------------------------------------------------------------------ Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195 View this thread: http://www.excelforum.com/showthread...hreadid=530357 |
Macro to print web page and close browser
Hello, Could anyone point me in the right direction with the following error: Line: 228 Char: 1 Error: 'dialogArguments_IE_PrintType' is null or not an object Code: 0 URL: res://C:\WINNT\system32\shdoclc.dll/preview.dlg I receive this error when using Tim's code in my macro to print a webpage (see below) IeApp.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER Here's what I've tried so far: 1. Added SYSTEM and INTERACTIVE to my default security permissions in DCOMCNFG.EXE 2. Added a references : sendcmsg.dll, to my form 3. Reinstalled Windows 5.6 Scripting Engine 4. Unchecked 3rd party browser extensions in advanced tab of internet options 5. Enabled all scripting / active X & java controls in security tab of internet options 6. Disabled smooth scrolling Thank you Oreg -- Oreg ------------------------------------------------------------------------ Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195 View this thread: http://www.excelforum.com/showthread...hreadid=530357 |
Macro to print web page and close browser
Error: 'dialogArguments_IE_PrintType' is null or not an object
I was using XP for my testing, so there may be some differences there. Try: http://support.microsoft.com/default...;EN-US;q293176 http://support.microsoft.com/default...;EN-US;Q303360 Tim |
Macro to print web page and close browser
Hi Tim, Thanks again for responding. My default printer is a network printer where I work. I do not have permissions to change spool settings so that could be the trouble. I will try to print to another printer and see if the trouble follows. Are there any other options for printing like a sendkeys method once the webpage has completely loaded? Oreg -- Oreg ------------------------------------------------------------------------ Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195 View this thread: http://www.excelforum.com/showthread...hreadid=530357 |
Macro to print web page and close browser
Tim, I found the trouble ! IeApp.quit was not allowing enough time to print the webpage. I was able to fix by using sleep to slow down macro. Thanks again for your help. :) Oreg -- Oreg ------------------------------------------------------------------------ Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195 View this thread: http://www.excelforum.com/showthread...hreadid=530357 |
All times are GMT +1. The time now is 10:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com