0

I trying to get the information from the website and sucessfully getting this using this code:

Dim IE As New InternetExplorer
IE.Visible = False
IE.navigate "https://www.theconstructionindex.co.uk" & Range("URL_code").Value
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim doc As HTMLDocument
Set doc = IE.document
Dim sDD As String
sDD = doc.getElementsByTagName("TD")(1).innerText
Range("b2").Value = sDD
sDD = doc.getElementsByTagName("TD")(3).innerText
Range("b3").Value = sDD
sDD = doc.getElementsByTagName("TD")(5).innerText
Range("b4").Value = sDD
sDD = doc.getElementsByTagName("TD")(7).innerText
Range("b5").Value = sDD
sDD = doc.getElementsByTagName("TD")(9).innerText
Range("b6").Value = sDD
sDD = doc.getElementsByTagName("TD")(11).innerText
Range("b7").Value = sDD

The problem is that each time I hit button and code runs it slows down the computer. I sure that it is memory management issue. Can anyone suggest how to free the RAM used by this code each time it runs?

1
  • How many Internet Explorers are opened currently? Commented May 28, 2018 at 12:38

1 Answer 1

1

Probably you are not closing the instances of Internet Explorer. They are invisible (IE.Visible = False), thus you do not see them, but they are there and they are eating RAM. This is a possible solution:

  • Close all your InternetExplorer Instances, by selecting TaskManager > Processes > InternetExplorer > Right Mouse Button > End Task (or restart your PC);
  • Then close each instance of IE once you stop working with it. Like this:

Sub TestMe()

    Dim ie As New InternetExplorer
    ie.Visible = False
    'do something here
    ie.Quit

End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

Can I automatically copy all the data from this website as the data is in tables. theconstructionindex.co.uk/planning-leads/16 the page is 16 then 17 then 18 and so on.. any solution that I hit button and all pages data into excel sheet. ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.