Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know the EXCEL is running
Message
 
To
08/11/2005 04:59:29
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 6 SP3
OS:
Windows 2000
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01066340
Message ID:
01066515
Views:
28
>Hi everyone,
>
>I have two question as below :-
>
>A. How can i know the EXCEL application is running in window ?
>
>B. How can i know the EXCEL FILE is opened by EXCEL at this monment ?
>
>Thank a lot

In addition to Cetin's advice, you can also:
lcOldOnError=on('error')
on error oExcel=.NULL.
oExcel=GetObject(,'Excel.Application')
on error &lcOldOnError
if isnull(oExcel) && GetObject did not detect an open excel object 
                  ** so you could open a "blank" excel session here
   oExcel=createobject('Word.Application')
else
   * oExcel is NOT null, therefore Excel is alread running on the DT
   if type('oExcel.ActiveSheet.name')="C"
      * Now you have the active sheet file name
      lcExcelFileName=oExcel.ActiveSheet.name
      * You can also loop through the activesheet collection
      * when more than one may be open, and you want to
      * be sure you don't re-open.
      * PS - you can test this and Cetins advice from the command window.
   else
      * Excel is open but no active sheet
   endif
endif
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform