Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to test if i can open an excel file exclus
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01547067
Message ID:
01547068
Vues:
46
>Hi all,
>
>I have some code that has worked for nearly a decade but i've rolled it out in a new way recently for a customer. I have a form that has a timer on it that runs a method every 15 minutes. A second excel file reads from this first one but on occasion the file i am trying to update is open, if only briefly. What happens in this case is that the excel files opens in read only mode and then crashes at the end. I've tried fopen() and other parameters but nothing tells me that the file is already open. Anyone help?
>The code I use to open the excel file is
>
>mfilename = "myexcelfile.xls"
>oleapp = createobject("Excel.Application")
>oleapp.Application.Workbooks.Open(mfilename)
>
>
>~M
mfilename = "myexcelfile.xls"
IF NOT EMPTY(SYS(2000, mfilename))
   lnHandler = FOPEN(mfilename,12)
   IF lnHandler < 0 && Can not open this file
      **** 
   ELSE
      FCLOSE(lnHandler)
   ENDIF
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform