PDA

View Full Version : Help with filling out webform from excel sheet



tsmia165
08-29-2018, 11:29 AM
I am sorry to bother you guys but I need some help. I have the current VBA script running on my excel worksheet. It worked fine for a day. Now instead of going through each row and inputting the information, it adds all the rows into the one field. I only get an email of submission for the row 2. How can I have a web form filled out for each row in my report?



Thank you!

Bellow is my script

Sub FillInternetForm()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")

IE.Navigate "://website"

IE.Visible = True



DoEvents 'wait until IE is done loading page.
Wend

Do While IE.busy Or IE.readyState <> 4
Application.Wait DateAdd("S", 1, Now)
Loop

Set doc = IE.document

For rowNo = 2 To 5

IE.document.All("Name").Value = ThisWorkbook.Sheets("sheet1").Range("a" & rowNo).Value
IE.document.All("Homeroom").Value = ThisWorkbook.Sheets("sheet1").Range("b" & rowNo).Value
IE.document.All("Lunch").Value = ThisWorkbook.Sheets("sheet1").Range("c" & rowNo).Value
IE.document.All("Break").Value = ThisWorkbook.Sheets("sheet1").Range("d" & rowNo).Value
IE.document.All("Balance").Value = ThisWorkbook.Sheets("sheet1").Range("e" & rowNo).Value
IE.document.All("email").Value = ThisWorkbook.Sheets("sheet1").Range("f" & rowNo).Value
IE.document.All("fb-submit-button").Click

Do While IE.busy Or IE.readyState <> 4
Application.Wait DateAdd("S", 1, Now)

Loop


Next

End Sub


any help would be greatly appreciated!!