Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP/Excel question - Closing Excel sheet
Message
De
18/11/1999 12:16:35
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00292412
Message ID:
00292527
Vues:
30
>>If you do background work then it's OK.
>>oExcel.ActiveWorkbook.Saved = .t. && Prevent prompt
>>oExcel.Quit
>>
>>If it's made visible so that user can intervene, different results occur depending type of closure (Close workbook - Ctrl+F4 or Close excel - Alt+F4).
>>There should be smarter ways but currently what I do is to check if I can fopen() the xls file and don't release the oExcel till I can (workbook closed). Otherwise I get crash if the user exits with Ctrl+F4 and oExcel is released already. If I declare it public then it's another story :)
>
>Hi Cetin - I was wondering about that. I haven't had time to test the Quit yet, but I may have some problems here, not sure. It's always a new Visible sheet of data the user will be starting with, but then they can edit it, save it any way or name they want, or just close it without doing any edits.
>
>Maybe I can just check TYPE of oExcel (a form property) at form closing time, and issue Quit if it's still 'O'. I'll have to test some, then re-post if I have any difficulties here...


You'll face some difficulties with checking type("oExcel") (been there before :) Then you have the other option which I can slightly detail for now (leave time is just near) :
public gnHwnd && or form property
-invoke excel
-Get window handle via API to gnHwnd
-Loop while iswindow(gnHwnd)

There are others like getting class and checking its existence, but I had troubles with it like it catches another excel window that's launched independently from fox too.
I didn't have a time to check IsAppRun(32) rom files section.
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform