I've got a userform that I use to submit data to a web form. I've recently started having issues with it not submitting the data to the web form. It happens intermittently, and not every time, so it makes me think that it might be more network issues causing a hiccup than my actual code. So I wrote some code that after the data is submitted, it opens the webform again and checks to see what the last entered data set was. This seems a bit slow, and I feel like there should be a better way to write a check code.
So right now, I've got a combination of a minimum of 11 comboboxes and textboxes in my user form. When I click the submit button the code executes these actions
-opens the web
-navigates to the url
-enters the data into the corresponding fields
-clicks the submit button on the webform
-closes IE
-Opens IE
-navigates to the url
-checks that the last entered data set was what I just entered
-closes IE
If something happened that for some reason the entered data doesn't match what I had just entered then it will give me a messagebox telling me that something happened.
I think this can be simplified because closing the web and reopening it to do my check just seems very inefficient. What I'm thinking about doing is an if statement after it enters the data into the corresponding fields on the web form. So it would be something like If field 1 = Textbox1 then click the submit button. This seems like it might be better than my current check code, but I would have to write it like: "If IE.getElementById("Field1").Value = Textbox1.Value And IE.getElementById("Field2") = Textbox2.Value etc etc, through all 11 controls" Is there a better or shorter way of doing this?
So right now, I've got a combination of a minimum of 11 comboboxes and textboxes in my user form. When I click the submit button the code executes these actions
-opens the web
-navigates to the url
-enters the data into the corresponding fields
-clicks the submit button on the webform
-closes IE
-Opens IE
-navigates to the url
-checks that the last entered data set was what I just entered
-closes IE
If something happened that for some reason the entered data doesn't match what I had just entered then it will give me a messagebox telling me that something happened.
I think this can be simplified because closing the web and reopening it to do my check just seems very inefficient. What I'm thinking about doing is an if statement after it enters the data into the corresponding fields on the web form. So it would be something like If field 1 = Textbox1 then click the submit button. This seems like it might be better than my current check code, but I would have to write it like: "If IE.getElementById("Field1").Value = Textbox1.Value And IE.getElementById("Field2") = Textbox2.Value etc etc, through all 11 controls" Is there a better or shorter way of doing this?
Last edited: