RE: Ghostly presence of Excel process
- From: "ragtopcaddy via AccessMonster.com" <u9289@uwe>
- Date: Thu, 30 Mar 2006 14:16:10 GMT
Many thanks (yet again!) to you and Roy,
I've implemented your suggestions, but I'm still having difficulty getting
rid of the Excel process. The Do While loop below is an endless loop. Could
you tell me what's missing?
The following code runs at the end of my StripXLFormats function:
Do While blXLRunning
MsgBox "Excel is still running!!!"
Stop
Set xlObj = GetObject(, "Excel.Application")
xlObj.Quit
Set xlObj = Nothing
blXLRunning = IsExcelRunning
Loop
End Function
The IsExcelRunning function code is below:
Public Function IsExcelRunning() As Boolean
Dim xl As Object
On Error Resume Next
Set xl = GetObject(, "Excel.Application")
IsExcelRunning = (Err.Number = 0)
Set xl = Nothing
Err.Clear
End Function
Klatuu wrote:
Without testing all this, I can't be absolutely positive where the problem
lies; however, these are some things to consider.
First, this is not uncommon. The problem is caused by incomplete object
referencing to your Excel objects. When Access sees an Excel object
reference that is not fully qualified, it will create another instance of the
Excel process. When you issue the Quit statement, the instance of Excel you
created in destroyed, but the one that Access created can still be running.
I see one place that is suspect:
Cells.Select
Cells.EntireColumn.AutoFit
These two lines don't explicitly tie the cells to your instance.
That may be why blXLRunning = IsExcelRunning is always true.
Also, I notice that after you call your function StripXLFormats, you open
the workbook again but never Quit Excel.
If you did, then the spread*** would disappear. If you want the user to
see the spread*** after you have completed it, the better way is to save
it, close, quit Excel, then use the Shell function to open it.
The code below runs at the end of a sub that exports queries via a[quoted text clipped - 124 lines]
transferspread*** routine to a new workbook which then has to be formatted,
Err.Clear
End Function
--
Bill Reed
"If you can't laugh at yourself, laugh at somebody else"
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200603/1
.
- Follow-Ups:
- Re: Ghostly presence of Excel process
- From: RoyVidar
- Re: Ghostly presence of Excel process
- References:
- Ghostly presence of Excel process
- From: ragtopcaddy via AccessMonster.com
- RE: Ghostly presence of Excel process
- From: Klatuu
- Ghostly presence of Excel process
- Prev by Date: Re: Eval function question
- Next by Date: RE: Ghostly presence of Excel process
- Previous by thread: RE: Ghostly presence of Excel process
- Next by thread: Re: Ghostly presence of Excel process
- Index(es):