samedi 4 décembre 2021

Please help! fill a html value with VBA

Good afternoon guys,

I'm writing a code to automatically fill some website with cells values:

Sub prueba()
Dim oIE As InternetExplorer: Set oIE = New InternetExplorer
Dim oDocument As HTMLDocument
Dim ECICOR As HTMLSelectElement
Dim i, j As Integer
Dim x As Long

oIE.Visible = True

oIE.Navigate "http://sirem.eci.geci/smcfs/console/login.jsp"


Do While oIE.readyState <> 4: DoEvents: Loop


With oDocument
Set oDocument = oIE.Document
End With
 
 
Call oDocument.parentWindow.execScript("window.parent.sc.postDummyFormForWindow('/smcfs/console/inventory.search');", "JScript")


Set ECICOR = oDocument.getElementById("enterpriseFieldObj")
ECICOR.Focus
ECICOR.Click
ECICOR.Value = "ECICOR"
ECICOR.FireEvent ("onChange")


oDocument.getElementsByClassName("unprotectedinput").Value = Cells(1, 1).Value


End Sub

So my problem is that the last line of my code always runs an error: Run-time error 438: Object doesn't support this property or method , when it should fill the next HTML code:


<INPUT class=unprotectedinput maxLength=40 name=xml:/InventoryItem/@ItemID OldValue="" dataType="STRING">

If you could find a solution I'd be very greatful.

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire