Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Handling internet explorer memory leaks from Excel VBA

I use Internet Explorer (IE) (both 8 and 9) from Excel 2003 via VBA.
I run IE8 from Windows XP and IE9 from Windows Vista.
(IE10 and IE11 are incompatible with Vista.)
I make repeated use of an instance of IE with
Public IE As SHDocVw.InternetExplorer _
' Needs Tools/References/Microsoft Internet Controls

....
If IE Is Nothing Then
Set IE = CreateObject("InternetExplorer.Application.1")
End If
....

I need to download train fare information with about 400k accesses.

Windows Task Manager shows 2 images names ieexplore.exe - a small one
and a large one.
The memory used by the large one gradually increases until it seizes.
When it seizes, control is not given to Excel until there is manual
interaction.
On Vista, the failure is a message box after about an hour:
' Microsoft Windows
' Internet Explorer has stopped working
' A problem caused the program to stop working correctly. Windows will
' close the program and notify you if a solution is available.
' Close program

I coded the following recursive asynchronous function helpful.
It stops IE being used for more than 10 minutes.

Private Sub saveSingleFares()
If Not ActiveWorkbook.Saved Then
IE.Quit
Set IE = Nothing
ActiveWorkbook.Save
End If
Application.OnTime EarliestTime:=Now + TimeValue("00:10:00"), _
Procedu="saveSingleFares"
End Sub

I will probably code something less brutal later.
I would prefer code to look at the IE memory usage
in making a decision on killing it.
--
Walter Briscoe
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
Excel Camera Tool Leaks memory stops VBA [email protected] Excel Programming 2 April 8th 08 07:37 PM
Available resource limits, memory leaks and linked files Jim Thomlinson Excel Programming 1 January 25th 07 05:27 PM
Huge Memory Leaks using ODBC Drivers from Excel to retrieve data Philip Excel Programming 7 October 5th 05 05:31 PM
documented memory leaks in Excel 2003 or OWC11? PatFinegan[_12_] Excel Programming 0 February 2nd 04 05:15 PM


All times are GMT +1. The time now is 05:44 AM.

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

About Us

"It's about Microsoft Excel"