karthik80c
asked on
The script runs in outlook 2013 but not in outlook 2010
The following script runs well in outlook 2013, but it shows the run-time error "Object variable or With block variable not set" in "line 14" when runs on outlook 2010.
Sub PropertyURLL()
Dim IE As New InternetExplorer
IE.navigate "http://www.realcommercial.com.au/property-retail-qld-kooralbyn-501463555"
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim sDD As String
sDD = Trim(Doc.getElementsByTagName("h1")(0).innerText)
Dim topic As MSHTML.IHTMLElement
Set topic = Doc.getElementById("description")
Debug.Print topic.innerHTML
Dim status As Variant
status = Doc.getElementsByClassName("saleType")(0).innerText
Dim body As Variant
body = Doc.getElementsByClassName("body")(0).innerText
Dim price As Variant
price = Doc.getElementsByClassName("price ellipsis")(0).innerText
Dim dtInspDate As Variant
Dim dtInspTime As Variant
Dim aTextTmp As Variant, aInspDate As Variant
aInspDate = Split(sDD, ", ")
dtInspDate = aInspDate(1)
dtInspDe = aInspDate(0)
Dim Poost As String
Poost = Right(sDD, 4)
Dim suburb As String
suburb = dtInspDate
Title = dtInspDe
MsgBox sDD
MsgBox topic
MsgBox status
MsgBox body
MsgBox price
MsgBox Poost
MsgBox Title
MsgBox suburb
End Sub
Private Sub test(CurrentItem As Object)
Dim currItem As MailItem
Set currItem = ActiveInspector.CurrentItem
PropertyURL currItem
End Sub
ASKER
Yes I have checked the reference "Microsoft Internet Controls". I didn't try run the code manually.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim dtInspDe As Variant, Title As Variant
but that should not cause the error you are getting.
Is it possible the code is processing too quickly? Does it work if you set a break point and step through the code manually?
OM Gang