Hi,
My goal is to Fill web forms using dynamic data which is stored in excel table. The proccess should look like the below:
Below is my version without a loop that works but only for B2:G2 Row.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub copy_project_loop()
Dim IE AsObject
Dim Doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
Dim SHELL_OBJECT
SHELL_OBJECT ="WScript.Shell"
Set objShell = CreateObject(SHELL_OBJECT)
IE.Visible =True
IE.navigate "URL link"
DoWhile IE.Busy
Application.Wait DateAdd("s",1, Now)
Loop
Set Doc = IE.document
Doc.getElementById("Project|Name").Value = ThisWorkbook.Sheets("data").Range("B2").Value
Doc.getElementById("customer|UserDefinedIdTA").Value = ThisWorkbook.Sheets("data").Range("C2").Value
Doc.getElementById("customer|UserDefinedIdTA").Focus
objShell.SendKeys "{Enter}"
Application.Wait DateAdd("s",2, Now)
Doc.getElementById("selEngagement").Value = ThisWorkbook.Sheets("data").Range("D2").Value
Doc.getElementById("txtPlannedStart").Value = ThisWorkbook.Sheets("data").Range("E2").Value
Doc.getElementById("Project|ProjTimeAppTA").Value = ThisWorkbook.Sheets("data").Range("F2").Value
Doc.getElementById("Project|SecondProjTimeAppTA").Value = ThisWorkbook.Sheets("data").Range("G2").Value
Application.Wait DateAdd("s",5, Now)
Doc.getElementById("Button1").Click
EndSub</code>
I find it difficult to understand hot Can I set a loop to go trough this dynamic range, do all the actions, and repeat by going to next link in the next row unntill the last row of the data.
Please help me undestand the proper syntax I should use for my goal.
Thanks,
My goal is to Fill web forms using dynamic data which is stored in excel table. The proccess should look like the below:
- Go to link stored in "A"i
- Fill the given fields in web form using data from "A"i to "G"i
- Click "save"
- Wait 5 seconds
- Populate column "H"i with text: "Created"
- Repeat next line (i+1) until last row
- When finished(after last row), msgbox: "proccess completed"
Below is my version without a loop that works but only for B2:G2 Row.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub copy_project_loop()
Dim IE AsObject
Dim Doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
Dim SHELL_OBJECT
SHELL_OBJECT ="WScript.Shell"
Set objShell = CreateObject(SHELL_OBJECT)
IE.Visible =True
IE.navigate "URL link"
DoWhile IE.Busy
Application.Wait DateAdd("s",1, Now)
Loop
Set Doc = IE.document
Doc.getElementById("Project|Name").Value = ThisWorkbook.Sheets("data").Range("B2").Value
Doc.getElementById("customer|UserDefinedIdTA").Value = ThisWorkbook.Sheets("data").Range("C2").Value
Doc.getElementById("customer|UserDefinedIdTA").Focus
objShell.SendKeys "{Enter}"
Application.Wait DateAdd("s",2, Now)
Doc.getElementById("selEngagement").Value = ThisWorkbook.Sheets("data").Range("D2").Value
Doc.getElementById("txtPlannedStart").Value = ThisWorkbook.Sheets("data").Range("E2").Value
Doc.getElementById("Project|ProjTimeAppTA").Value = ThisWorkbook.Sheets("data").Range("F2").Value
Doc.getElementById("Project|SecondProjTimeAppTA").Value = ThisWorkbook.Sheets("data").Range("G2").Value
Application.Wait DateAdd("s",5, Now)
Doc.getElementById("Button1").Click
EndSub</code>
I find it difficult to understand hot Can I set a loop to go trough this dynamic range, do all the actions, and repeat by going to next link in the next row unntill the last row of the data.
Please help me undestand the proper syntax I should use for my goal.
Thanks,