can't close Excel from VBA

overclockgirl

New member
Local time
Today, 15:28
Joined
Jun 6, 2007
Messages
5
I am writing code to open many Excel files, retrieve data, and populate Access tables. However, there is always one instance of Excel still running in my "processes" in task manager (doesn't show up in "applications") -- i just can't get it to close. Any help would be greatly appreciated! Here is some of my code:

Public Sub LaunchExcel(Files() As String, k As Integer)
Dim intk As Integer
Set appExcel = CreateObject("Excel.Application")
appExcel.Visible = False
For intk = 1 To k
strxls = Files(intk)
appExcel.Workbooks.Open strxls, ReadOnly
IDRad 'calls functions that read data, etc.
appExcel.Workbooks.Close strxls
Next intk
appExcel.quit
set appExcel = nothing
End Sub

I have also used the code: appExcel.quit in several places because multiple instances of Excel stayed open if i didn't.
thanks in advance
 
If you are using any code, whatsoever, which does not use explicit referencing then that will hold it open until Access closes.

For example, if I use

Activecell = Me.MyTextBox

then I have a problem.

I would want to use the workbook or worksheet object as qualifier:

xlWS.Activecell = Me.MyTextBox
 
Do you have one of the objects/properties, etc set to a global variable?

That will hold it open until access is closed also.
 

Users who are viewing this thread

Back
Top Bottom