aziz rasul
Active member
- Local time
- Today, 06:45
- Joined
- Jun 26, 2000
- Messages
- 1,935
I have the following code, which closes an MS Excel file which is open:
The code works OK but leaves the Excel instance of the file still in memory. Is there any line of code I can use to get rid of this instance?
Code:
Public Sub CloseExcelFile(strExcelFile As String)
Dim objExcelApp As Object
Set objExcelApp = GetObject(strExcelFile)
With objExcelApp
.Application.Visible = False
.Close SaveChanges:=False
End With
Set objExcelApp = Nothing
End Sub
The code works OK but leaves the Excel instance of the file still in memory. Is there any line of code I can use to get rid of this instance?