My code is
When I click on Command2, Excel window is closed but an Excel process always appears in Window Task Manager,Process Tab. If I run above code again, two Excel processes are in Window Task Manager and so on.Code:Public xApp As Excel.Application
Private Sub Command1_Click()
Dim wb As New Excel.Workbook, str As String
Set xApp = CreateObject("Excel.Application")
xApp.Visible = True
str = "Myfile.xls"
Set wb = xApp.Workbooks.Open(FileName:=str)
wb.Close False
End Sub
Private Sub Command2_Click()
xApp.Quit
Set xApp = Nothing
End Sub
Anyone can help me to terminate Excel processes?
