I think you run out of memory, can you check how many iexplorer.exe
you have in task manager?
In some broken Windows System, your IE.Quit will fail...
also note the following points:
for outer loop and for inner loop use different variable name for the IE object outer loop:
ie
, inner loop:ie2
you used
ie.quit
inside thewith ie.document
block, might cause problem?According to this post, you can try removing the
Sleep
statement inside theDo
Loop
I would usually use
Do While IE.Busy
Loop
Do While IE.readyState <> 4
Loop
EDIT:
For IE.Quit NOT able to kill all iexplorer.exe, maybe due to this reason, To ensure there's no memory leakage, you can rearrange your code AND force kill all IE instance using method in Googling VBA Kill IE
You should rearrange like this
for i = XXXX ' OUTER FOR LOOP
set IE = 'outer URL
with IE
' assgin the param. into variables
start = IE. XXX
end = IE.YYY
end with
IE.quit
for j = start to end ' INNER FOR LOOP
set IE = ' inner url
'loop inner IE
with IE
end with
IE.quit
next j
next i