I am opening Excel from MsAccess and when I finished the task I close it, but Excel remain opened in backgroud until I close MsAccess
this is the code
Public Sub closeExcel()
Dim xlApp
Dim wkb As Object
Dim wks As Object
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If err <> 0 Then
Set xlApp = CreateObject("Excel.Application")
End If
With xlApp
Set wkb = .Workbooks.Add
Set wks = wkb.Worksheets(1)
wkb.Close True
Set wks = Nothing
Set wkb = Nothing
.Quit
End With
End Sub
I need to remain Access runing, but I want that Excel be closed. How can I do this?