Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing a link to an Excel app
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Closing a link to an Excel app
Miscellaneous
Thread ID:
00748912
Message ID:
00748912
Views:
53
I've got a little utility that uses OLE to open and interogate an Excel spreadsheet in VFP.

An abstract of my methodology:

WITH THIS
m.lcSrcXLS = GETFILE('XLS')

.hoExcelApp = CREATEOBJECT("Excel.Application")

IF NOT ISNULL(.hoExcelApp)
WITH .hoExcelApp
.Workbooks.Open(m.lcSrcXLS, .F., .T.) && readonly
.Workbooks[THIS.pnXlsWorkbook].Activate()
.Worksheets[THIS.pnXlsSpreadsheet].Activate()
ENDWITH

*** get information from the Excel spreadsheet

.hoExcelApp.WorkBooks(.pnXlsWorkbook).Close()
.hoExcelApp = .NULL.
ENDIF
ENDWITH

My problem is that when I leave the program, VFP still has a lock on the XLS file. I would have thought that the Closee() method would have broken the link into the XLS file, and NULLing the Excel object should have broken any ties to Excel.

What's missing?

TIA
Thom C.
Next
Reply
Map
View

Click here to load this message in the networking platform