Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing excel after automation causes GPF in excel
Message
From
15/12/1999 04:44:00
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
14/12/1999 06:41:47
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00303229
Message ID:
00303934
Views:
30
>Hi
>I am using excel as an automation server, and dumping some data into excel.
>
>When I make excel visible, and then close excel from within excel, I get a GPF error from excel, when control is returned back to VFP.
>
>Does anyone have any ideas how to stop this.
>
>Thanks in advance
>
>Regards
>
>Steven Bowskill


Steven,
You don't say how Excel is closed but my guess is that it's closed with Ctrl+F4 or by pressing "x" for worksheet and the oExcel is released.
If that's the case you should keep oExcel alive till excel is closed then release it.
You should check its existence with winapi calls or use this easier (but not smart) way :
handle = fopen("myxls.xls",12) && active xls in excel
do while handle < 0   && Loop while cannot be opened
 handle = fopen("myxls.xls",12)
enddo
=fclose(handle) && Excel freed - closed
release oExcel
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform