Public Sub Close_excel() If IsNull(objExcel) Then Exit Sub End If objExcel.Close MsgBox "closed!" Set objExcel = Nothing End Sub With objExcel If .Application.Windows().Count = 1 Then .Application.Quit 'Excel is already active before this program starts. Else .Close End If
If IsNull(objExcel) Then
Exit Sub
End If
objExcel.Close
MsgBox "closed!"
Set objExcel = Nothing
End Sub
With objExcel
If .Application.Windows().Count = 1 Then
.Application.Quit
'Excel is already active before this program starts.
Else
.Close
End If
Set objExcel = Nothing
End With
[email protected], thanksto 寒刃:
没有看懂你的程序,可否解释一下?
你的objexcel应该是workbooks对象吧,否则不会有close方法