问题:
如何用 ACCESS 在后台删除 XLS 文件的某个工作簿,且不出现提示《OA》
回答:
Function DeleteSheetTest1()
Dim app As New Excel.Application
Dim wkb As Excel.Workbook
Set wkb = app.Workbooks.Open("c:\temp\1212.xls")
app.Visible = False
app.DisplayAlerts = False
wkb.Sheets("sheet2").Delete
app.DisplayAlerts = True
wkb.Save
End Function
Function DeleteSheetTest2()
Set xl = GetObject("c:\temp\1212.xls")
xl.Application.Visible = False
xl.Application.Windows("1212.xls").Visible = False
xl.DisplayAlerts = False
STRA = "sheet2"
xl.Sheets(STRA).Delete
xl.DisplayAlerts = True
End Function


