Hi guys
this is my first question here, hope you see me often from now on.
I was using a code today, and it was running perfectly this morning - And now, i get "RUN-TIME ERROR '438': Object doesn't support this property or method"
the error occurs on this line of code:
[CODE]For Each oElement In .document.getElementsByClassName("painelAprovacaoItem")[\CODE]
Weird thing: If I change getElementsByClassName to getElementsByTagName it runs properly, but it doesn't works for what I need.
does anyone knows what it could be?
Follow the complete code:
![]()
Sub Acoes() Sheets("Ações").Select Rows("2:2").Select Range(Selection, Selection.End(xlDown)).Select Selection.Delete Set ie = CreateObject("internetexplorer.application") 'Abrir IE iRow = 5 iRowa = 2 Sheets("PAs").Select While Range("B" & iRow).Value <> "" PA = Range("B" & iRow).Value With ie .Visible = True .navigate "url" Do While .busy Or _ .readystate <> 4 DoEvents Loop .document.getElementByID("txtCodigo").Value = PA .document.getElementByID("btnConsultar").Click Do While .busy Or _ .readystate <> 4 DoEvents Loop .document.getElementByID("dgResultado__ctl3_lblTituloValor").Click Do While .busy Or _ .readystate <> 4 DoEvents Loop For Each oElement In .document.getElementsByClassName("painelAprovacaoItem") MsgBox (oElement) Acao = oElement.Children(0).InnerText Descricao = oElement.Children(1).InnerText Responsavel = oElement.Children(2).InnerText Vencimento = oElement.Children(4).InnerText Status = oElement.Children(5).InnerText If Status = "Cancelada " Or Status = "Concluída " Then Else Workbooks("PA - RI.xlsm").Activate Sheets("Ações").Select Range("A" & iRowa).Value = PA Range("B" & iRowa).Value = Acao Range("C" & iRowa).Value = Descricao Range("D" & iRowa).Value = Responsavel Range("E" & iRowa).Value = Status Range("F" & iRowa).Value = Vencimento iRowa = iRowa + 1 End If Next oElement Sheets("PAs").Select iRow = iRow + 1 End With Wend ie.Quit MsgBox "Done" End Sub
thanks a lot :D
Bookmarks