Beginner at VBA, I created a button to send data from a worksheet to an online form - a simple timecard
Online Form: 3 checkboxes, 6 textboxes
chkboxJOB1
txtNameJOB1
txtHoursJOB1
chkboxJOB2
txtNameJOB2
txtHoursJOB2
chkboxJOB3
txtNameJOB3
txtHoursJOB3
What I want to do is if the web form is empty (assume it is the first job of the day), check the first chkbox and populate those two fields, and End. User goes to his next job, fills out a new worksheet, presses the button, now it checks the JOB2 box and populates that section. User goes to Job 3, fills out worksheet, sends to JOB3 section. FYI: The form saves/retains its values using local storage and gets submitted once at end of day.
HOW DO I DO THIS???
HERE IS MY BASIC CODE to just send info to first section:
Private Sub sendtimecard()
Dim ie As Object
Dim i As Integer
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "
Do
DoEvents
Loop Until ie.ReadyState = 4
ie.Document.getElementById("chkboxJOB1").Checked = True
ie.Document.getElementById("txtNameJOB1").Value = ThisWorkbook.Sheets("Sheet1").Range("A1")
ie.Document.getElementById("txtHoursJOB1").Value = ThisWorkbook.Sheets("Sheet1").Range("B1")
End Sub
Online Form: 3 checkboxes, 6 textboxes
chkboxJOB1
txtNameJOB1
txtHoursJOB1
chkboxJOB2
txtNameJOB2
txtHoursJOB2
chkboxJOB3
txtNameJOB3
txtHoursJOB3
What I want to do is if the web form is empty (assume it is the first job of the day), check the first chkbox and populate those two fields, and End. User goes to his next job, fills out a new worksheet, presses the button, now it checks the JOB2 box and populates that section. User goes to Job 3, fills out worksheet, sends to JOB3 section. FYI: The form saves/retains its values using local storage and gets submitted once at end of day.
HOW DO I DO THIS???
HERE IS MY BASIC CODE to just send info to first section:
Private Sub sendtimecard()
Dim ie As Object
Dim i As Integer
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "
Do
DoEvents
Loop Until ie.ReadyState = 4
ie.Document.getElementById("chkboxJOB1").Checked = True
ie.Document.getElementById("txtNameJOB1").Value = ThisWorkbook.Sheets("Sheet1").Range("A1")
ie.Document.getElementById("txtHoursJOB1").Value = ThisWorkbook.Sheets("Sheet1").Range("B1")
End Sub