Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with closing Excel opened by automation
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01232734
Message ID:
01233567
Views:
14
>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?
>
>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()
>
>

Ha :) Both you and on Russian web-site where I discuss the same problem suggest various workarounds. But I want to make my code/idea work! Stubborn, perhaps. I'm thinking, what if they changed something and want to save?

Anyway, my current code (with the slight modification of Excel.hwnd) works, so I may leave it like that, since I have to solve different more important and urgent problems and this was something I artificially created for myself.

But your future ideas are more than welcomed, as well as somebody's else.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform