Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with closing Excel opened by automation
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01232734
Message ID:
01233564
Vues:
8
Naomi,

Sorry but I still did not get my coffee so I can barely understand anything yet.

>Here is the idea of my code:
>
>If I found, that the file I want to create is currently opened by Excel, I want to bring Excel to front, let the users close it, and then proceed with creating Excel and opening it again.

Do you really need user intervention? I do not see the point unless they know they will need to "Save AS", otherwise any changes they will do will be overwrited, wouldn't it?

(And you can ask them from within your application, something like, "This sheet is open and I needit, if you do not want to lose your data, you better give me a alternative name so I can save it for you") and you can automate the saving as

Maybe something like this works for you?
lcFileName		= 'SomeDrive:\SomePath\SomeFile.XLS'
loBook			= Getobject(lcFileName) && If it is already open you'll get a reference to it
loExcel			= loBook.Application
loBook.Close(.f.)
loExcel.Quit()
Now, not sure what will happen if the user has it open the same file multiple times
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform