Thread: Ghost of Excel
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Ghost of Excel


if you save a temporary copy it should work ok...
'''
....
set appXL = APPLICATION
....

' Setup fixed data variables
strSFName = appXL.ThisWorkbook.Name & ".bak"
strPath = appXL.ThisWorkbook.Path
strCName = strPath & "\code.txt"

' Make sure "BAK" file is killed first
If Dir(strPath & "\" & strSFName) < "" Then Kill strPath & "\" &
strSFName
' Save a copy of this file for ado to connect to.
appXL.ThisWorkbook.SaveCopyAs strPath & "\" & strSFName


dont forget to kill the bak file at the end of your routine.


another point of concern...
dont use the old DAO drivers, code for proper ADO/Jet drivers.
get your connectstrings from http://www.able-consulting.com/ADO_Conn.htm



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


keepITcool wrote :


Paul...

ADO cannot reliably query opened workbooks.
see
http://support.microsoft.com/default...b;en-us;319998

it will lead to memory leaks, and may cause excel instance
to become 'uncloseable'


--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



Paul - NottsUK wrote :

Robert,

It probably is neater but I still end up with a ghost process at the
end.

Paul

"Robert Bruce" wrote:

Paul - NottsUK wrote:
Are you sure you need this:

Set appXL = GetObject(, "Excel.Application")

if you're coding in Excel?

Wouldn't

Set appXL = Application

work better?

Rob