Hello,
I am trying to add data into a webpage , with vba. I can pass the values correctly but they are not saved
the following code passes the values correctly :
if I do it manualy right after I press the character "f", wich is the first character of the variable string "desc", some event is triggered and a new empty line is added for data entry, but if i do it as in the above code with VBA, the value is entered but the event is not happening, the new empty line not created and the data is not stored
So far I tried to create an event that simulates manual data entry like this :
:
and still it does not work.
Any thoughts about this ?
I am trying to add data into a webpage , with vba. I can pass the values correctly but they are not saved
the following code passes the values correctly :
Code:
Dim desc as string, nLinha as integer
desc =" first of 4 invoice lines to be added"
for nLinha= 0 to 3
ie.Document.getElementById("sales_invoice_line_items_attributes_" & nLinha & "_description").Value = desc
next
if I do it manualy right after I press the character "f", wich is the first character of the variable string "desc", some event is triggered and a new empty line is added for data entry, but if i do it as in the above code with VBA, the value is entered but the event is not happening, the new empty line not created and the data is not stored
So far I tried to create an event that simulates manual data entry like this :
:
Code:
Dim ieEvent
Dim htmldoc as HTMLDocument
Set htmldoc = ie.Document
for nLinha= 0 to 3
ie.Document.getElementById("sales_invoice_line_items_attributes_" & nLinha & "_description").Value = desc
Set ieEvent = htmldoc.createEvent("HTMLEvents")
ieEvent.initEvent "change", False, True ' tambien probe con "keypress"
ie.document.all.Item("sales_invoice_line_items_attributes_" & nLinha & "_description").dispatchEvent ieEvent
next
and still it does not work.
Any thoughts about this ?