Error 91

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The following code is giving me the error:
Runtime error 91: 'Object variable of With Block variable not set'

....
If Iexplr Is Nothing Then Set Iexplr =
CreateObject("InternetExplorer.Application")
With Iexplr
.Navigate URL:=URL ' URL contains a valid web
address
Do ' wait till
iexplore is done.
Loop Until .ReadyState = READYSTATE_COMPLETE
a = .Document.Body.innertext ' put the whole page into a
string

' more code
End With
....

This is part of a subroutine that retrieves plain text from a webpage for
further processing.

The error comes intermittently at the last line shown (a=
..Document.Body.innertext)
ie. I run it and the error comes up. I run it again and the code works.

Thank you for any suggestions
 
Back
Top