I am encountering an
Object doesn't support this property or method
Runtime error in excel vba.
Note : The code works fine in my laptop.This error happened when I migrated the code to my desktop pc.
Below is the UPDATED code.
Dim ie As InternetExplorer
Dim htmldoc As MSHTML.IHTMLDocument
Dim ro1 As MSHTML.IHTMLElementCollection
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = False
ie.navigate "url"
Set htmldoc = ie.document
Set ro1 = htmldoc.getElementById("table id").getElementsByTagName("tr")
ThisWorkbook.Sheets(1).Cells(k, j) = rows(k).Children(0).textContent
ro1(k).Children(0).textContent is the error part.
I have checked Tools->References. Microsoft Internet Controls and Microsoft HTML Object Library has been checked.
Can anyone please guide me for this ?
Option Explicitat the top of your module, and thenDebug->Compileto identify variables and objects that aren't properly declared or are being misused, Keep compiling until no more warnings.rows(k).Children(0)? Run in Immediate Window:?TypeName(rows(k).Children(0))rows(k).Children(0).textContentwithrows(k).Children(0).InnerText. Did you try that?