'Populate online timecard
Sub sendtimecard()
On Error GoTo Err_sendtimecard
Dim i As Integer
Dim ws As Worksheet, wsINV As Worksheet
For Each ws In ThisWorkbook.Worksheets
Select Case ws.Name
Case "Invoice", "Invoice1", "Invoice 1"
Set wsINV = ws
Exit For
End Select
Next
With CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate "[URL unfurl="true"]http://website.com"[/URL] 'THIS IS LOCAL TEST SITE ONLY!
Do
DoEvents
Loop Until .ReadyState = 4
'Start populating job fields from job1 to job9, based on next empty Job chkbox...
With .Document
For i = 1 To 9
If Not .getElementById("chkboxJOB" & i).Checked Then
.getElementById("chkboxJOB" & i).Checked = True
.getElementById("txtNameJOB" & i).Value = wsINV.Range(RANGE_CUSTNAME)
.getElementById("invoiceJOB" & i).Value = wsINV.Range(RANGE_INVOICENUMBER)
' .getElementById("txtNameJOB" & i).Value = Worksheets("Invoice").Range(RANGE_CUSTNAME)
' .getElementById("invoiceJOB" & i).Value = Worksheets("Invoice").Range(RANGE_INVOICENUMBER)
Exit Sub
End If
Next
MsgBox "Timecard is full!"
End With
End With
Exit_sendtimecard:
Exit Sub
Err_sendtimecard:
MsgBox Err.Description
Resume Exit_sendtimecard
Set ws = Nothing
End Sub