Macro to print web page and close browser

O

Oreg

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
 
O

Oreg

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
 
O

Oreg

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
 
O

Oreg

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
 
O

Oreg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top