Hello members,
Im working with the for loop to iterate through webpage node collection.
Data i want to pull out are everytime nested in node number 2.
But my code breaks telling me Invalid argument error. My thoughts are probably because double Item property.
Also childNodes property is always corrected by engine to ChildNodes with upper "C" at the beggining of code.
I tried fixing the code with 'With' statement to correct namespace but i dont know how to.
full code:
Thanks for your help.
R.
Im working with the for loop to iterate through webpage node collection.
Data i want to pull out are everytime nested in node number 2.
Code:
ChildNodes.Item(2).innerText
But my code breaks telling me Invalid argument error. My thoughts are probably because double Item property.
Also childNodes property is always corrected by engine to ChildNodes with upper "C" at the beggining of code.
I tried fixing the code with 'With' statement to correct namespace but i dont know how to.
full code:
Code:
Sub sendToAccess(ByVal elements As MSHTML.IHTMLElementCollection)
Dim dbConn As ADODB.Connection
Dim dbRs As ADODB.Recordset
Dim dbConnString As String
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Double
dbConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\mydb.accdb;"
Set wb = Workbooks("mysheet.xlsm")
Set ws = wb.Worksheets("Sheet1")
'for loop is not finished
For i = 1 To elements.Length
'With elements
ws.Range("A1").Value = elements.Item(i).ChildNodes.Item(2).innerText 'problem line
ActiveCell.Cells.Columns.AutoFit
'End With
Next i
'... further code...
End Sub
Thanks for your help.
R.