① 如何用vb關閉已經打開的excel文件
DimWbAsWorkbook
SetWb=GetObject(ThisWorkbook.Path&"Sorterlist1.xls")
Wb.CloseFalse
② VB編程打開和關閉EXCEL文件
Dim EApp As Object『定義一個全局變數
Private Sub CommandButton1_Click()'打開
Set EApp = CreateObject("Excel.Application")
EApp.Visible = True
End Sub
Private Sub CommandButton2_Click()'關閉
If Not EApp Is Nothing Then
EApp.Quit
End If
End Sub