How to fill a form and click a button in IE with VBA?
Hello,
I am trying to put NUM1 and NUM2 into an online form, click BUTTON1 to submit, and in a pop-up, click BUTTON2 to verify, all automatically through VBA in Excel.
The VBA and HTML are attached, I just don't know which parts of the HTML connect to which parts of the VBA.....
Guidance would be more than welcome.
as all input and other elements are anonymous (no names or IDs), the only way would be to loop through all input elements and match some unique part of the inner html string
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Re: How to fill a form and click a button in IE with VBA?
try like
Code:
for each ele in browser.getelementsbytagname("input")
if instr(ele.innerhtml, "placeholder="Your Bid") > 0 then ele.vale = num1
if instr(ele.innerhtml, "placeholder="something") > 0 then ele.value = num2
next
typed in the browser so may contain typos or code errors
i doubt that dealing with the popup would be so easy
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete