Public Sub sendtyt()
On Error GoTo errs
DoCmd.SetWarnings False
DoCmd.OpenQuery "推移图生成表查询" '运行生成表查询,因为ADO有时不认存在条件的查询语句与SQL语句
DoCmd.OpenQuery "推移图接单下月汇总"
DoCmd.SetWarnings True
Dim xlapp As Excel.Application
Dim xlBOOK As Workbook, xlSHEET As Worksheet
Dim TableA As Variant, DB As Database, Wks As Workspace
Dim mymonth, myyear
xlSHEET.cells(25, cel) = Val(TableA!接单数量)
xlSHEET.cells(27, cel) = Val(TableA!出货数量)
If Val(TableA!接单数量) = 0 Then xlSHEET.cells(25, cel).Font.ColorIndex = 3
If Val(TableA!出货数量) = 0 Then xlSHEET.cells(27, cel).Font.ColorIndex = 3
If TableA!周 = 1 Then xlSHEET.cells(24, cel).Font.ColorIndex = 3
TableA.MoveNext
Next i
errs2:
Set xlapp = Nothing
Set xlSHEET = Nothing
Set xlBOOK = Nothing
Set xlSHEET = Nothing
Set Wks = Nothing
Set TableA = Nothing
Set DB = Nothing
Exit Sub
errs:
If err = 1004 Then
'[Forms]![货款结算]![确定].SetFocus
MsgBox (myyear & "年" & mymonth & "月推移图.xls") & "已打开,文件无法保存!"
xlapp.Visible = True
Exit Sub
Else
MsgBox "未定义错误,请告知程式作者" & err & Error, 16
End If
GoTo errs2
End Sub