Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to include Close Print Preview Vic Charts and Charting in Excel 1 January 9th 06 01:06 AM
how to close active ie browser using a macro [email protected] Excel Programming 2 October 14th 05 06:38 PM
Close an Internet Explorer browser window [email protected] Excel Programming 1 July 5th 04 06:25 PM
Close Browser window with VBA brianelson Excel Programming 1 July 12th 03 05:35 AM


All times are GMT +1. The time now is 11:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"