Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting Excel being open
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01162978
Message ID:
01163066
Views:
16
This message has been marked as the solution to the initial question of the thread.
>Thanks BB. On the ball as usual! :-)
>
>So, in the code after:
>loExcel .Visible = .T.
>
>... where control is passed to the user, in Excel, I have:
>
>Wait Window "Done"
>.ActiveWorkBook.Close()
>.Quit()
>loExcel = NULL
>RELEASE loExcel
>
>so I wouldn't need the
>
>.ActiveWorkBook.Close()
>.Quit()
>
>cos the user is forced to do that before being allowed to continue with VFP?
>
>UPDATE:
>
>I've done the above and now it goes into an unbreakable do loop, whether I've closed Excel before returning to the VFP app window, or I've left Excel open and returned. I have
>
> loExcel.Visible = .T.
> Wait Window "Done"
>* For Now> loExcel.ActiveWorkBook.Close()
>DO WHILE TYPE( [loExcel.Name]) == [C] AND;
> NOT ISNULL( loExcel)
> Sleep(300) && Put it in sleep mode so other application can work :-)
>ENDDO
>* For Now> loExcel.Quit()
>loExcel = NULL
>RELEASE loExcel


Hmm, it sounds to be that the EXCEL doesn't release its object when you have reference to it. This code works for me but as I said I used it againt Word. Try:
loexcel = CREATEOBJECT([Excel.Application])
loexcel.Visible = .t.
Wait Window "Close the Excel to continue..." NOWAIT
DECLARE Sleep IN WIN32API INTEGER
DO WHILE TYPE( [loExcel.Name]) == [C] AND;
   NOT ISNULL( loExcel)               AND;
   loExcel.Visible
   Sleep(300) && Put it in sleep mode so other application can work :-)
ENDDO
loExcel     = NULL
RELEASE loExcel
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform