Results 1 to 3 of 3

Thread: Problem in closing Internet Explorer

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hong Kong
    Posts
    38
    I am writing a program which would create an instance of IE(version 5.51) to navigate to a site. The page I retrieve will automatically send data to this IE at a 10 seconds interval to refresh the screen. The problem was that I could not terminate this IE instance.

    I create the instance of IE with the following statements:

    Private WithEvents mobjIE As SHDocVw.InternetExplorer
    Set mobjIE = CreateObject("InternetExplorer.Application")

    then navigate to the site with :
    mobjIE.Navigate strQAddr, 2

    then retrieve the content of the page via :
    Dim doc As HTMLDocument
    Set doc = mobjIE.Document

    then I tried to terminate the instance of IE using :
    mobjIE.Stop
    mobjIE.Quit

    the program then executes the End statement.

    But the IE instance is still there, and still receiving data from the site.

    If the program starts up and executes again, another IE is created, taking up additional resource and very soon my machine is low in memory.

    Could anyone tell me what I have done wrong ?

    Help is much appreciated.

    Terence

  2. #2
    Guest
    Set your object to nothing to free up it's resources.

    Code:
    Set mobjIE = Nothing
    '
    Set doc = Nothing

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Hong Kong
    Posts
    38
    Matthew,

    Thanks.

    Sorry, I forgot to mention. I did set both IE and document object to nothing before my application ended. However, the IE was still there.

    I did a search on MSDN and found an article "Visual Basic Component Shutdown Rules" in section Visual Basic concept. Then I suspected the coding in the web page I retrieved was executing which prevented IE to terminate. I could think of only way to stop it to execute, navigate to somewhere else. So, I add the statement :

    mobjIE.gohome before mobIE.stop and .quite. But it did not work, and kept contiuously getting data from the site every 10 seconds after my program ended.

    Any suggestions ?

    Terence

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width