C
confused
I do not know how to write the code to open an excel template.
I get this message " Query must have at least on destination field"
This is what I have so far:
With oExcel
If Not .OpenTemplate(gstrMainPath & gstrARStatusTemplate) Then
MsgBox "Missing Template " & gstrMainPath &
gstrEmpHrsbyCatTemplate, _
vbOKOnly + vbCritical, "Error"
GoTo MyExit
End If
.ActivateSheet "Sheet1"
.Home
'.Show
'set up collection of matters
Do While Not rsQ.EOF
If r = 0 Then
.InsertRange "Date", Format(Now, "mm/dd/yyyy"), False
'
Else
.InsertOffset r, 0, Trim(rsQ!Emp_no), False
End If
.InsertOffset r, 0, rsQ!Emp_no, False
.InsertOffset r, 1, rsQ!Name, False
.InsertOffset r, 2, rsQ!Hours, False
.InsertOffset r, 3, rsQ!Sick, False
.InsertOffset r, 4, rsQ!Vac, False
.InsertOffset r, 5, rsQ!Personal, False
.InsertOffset r, 6, rsQ!Holiday, False
.InsertOffset r, 7, rsQ!Other, False
.InsertOffset r, 8, rsQ!STD, False
r = r + 1
rsQ.MoveNext
Loop
I looked at sample code to find this much.
I get this message " Query must have at least on destination field"
This is what I have so far:
With oExcel
If Not .OpenTemplate(gstrMainPath & gstrARStatusTemplate) Then
MsgBox "Missing Template " & gstrMainPath &
gstrEmpHrsbyCatTemplate, _
vbOKOnly + vbCritical, "Error"
GoTo MyExit
End If
.ActivateSheet "Sheet1"
.Home
'.Show
'set up collection of matters
Do While Not rsQ.EOF
If r = 0 Then
.InsertRange "Date", Format(Now, "mm/dd/yyyy"), False
'
Else
.InsertOffset r, 0, Trim(rsQ!Emp_no), False
End If
.InsertOffset r, 0, rsQ!Emp_no, False
.InsertOffset r, 1, rsQ!Name, False
.InsertOffset r, 2, rsQ!Hours, False
.InsertOffset r, 3, rsQ!Sick, False
.InsertOffset r, 4, rsQ!Vac, False
.InsertOffset r, 5, rsQ!Personal, False
.InsertOffset r, 6, rsQ!Holiday, False
.InsertOffset r, 7, rsQ!Other, False
.InsertOffset r, 8, rsQ!STD, False
r = r + 1
rsQ.MoveNext
Loop
I looked at sample code to find this much.