Application Close Event
"Robert Schwenn" wrote in message
Peter T wrote:
I recall the discussion which (I think) led to Chip's Com-Addin but I'm
not
sure it will do quite what you want. Hopefully Chip will advise either
way.
When the Com-Addin is loaded, it does exactly what I want.
Good, I misunderstood exactly what you were after.
The sore point is,
that it's functionality would be needed on machines, where the Com-Addin
is not
registered. I only could place it on a mapped network share. So the next
question:
== Is it possible to load the Com-Addin (with a known path) from within a
VBA
project, although the Com-Addin is not registered on the system?
If the user can be persuaded to manually add the Com-Addin registration
occurs automatically. Job done. The normal way to distribute a Com-Addin is
with an Installer. Thinking aloud, as in I haven't done it but I don't see
why not, your VBA could do the following:
1. Check if the ComAddin is installed
attempt to reference the ComAddin, if not -
2. register the dll Shell Regsrv32
That's doable although there's a fair bit involved overall
3. Add registry entries
HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\ Addins\MyAddin.Connect
and four sub keys
4. Application.COMAddIns.Update
Steps 2 & 3 are what an installer would do, having enuserd there are no
running instances of Excel.
As a different approach maybe consider any attempt to close your file as
equivalent to closing Excel. If that's feasible have a go with the
following, lightly tested and no doubt with holes, hopefully plug'able!
It's an idea. But i believe, that it's amazing for the user to see any
other
workbooks to be closed...
I agree and would bin any file sent to me that did that. If following that
route it would be sensible to add a message (in code previously posted)
advising user what was about to occur (close all wb's & quit with options to
save changes) with the option to abort.
However I wouldn't take much more kindly to not being able to close any file
as I wish, which if I follow is what you want to do, ie keep your open
permanently until Excel quit.
Regards,
Peter T
|