Kill statement fails

C

c mateland

I'm using a simple Kill statement in a auto_open ppa that refuses to
run correctly. I get a permission denial (70), but it seems to be a
just problem with timing. In debugging, I can step through without a
hiccup, but when I run the code, it fails at the Kill statement. Yet
when I continue the run with F5 or step through it, the Kill statement
excecutes fine again.

It's as if PowerPoint wanted to wait a minute for the actions to catch
up or something.

FWIW, the file being killed is a ppa that was lines earlier removed,
unloaded, unautoloaded, etc. from my addins. I then delete the file.
Pretty simple, I would think.

I tried DoEvents after each removal action from my list of addins. But
that didn't work.

Any thoughts or can someone tell me my error?

v2002

FWIW, here's a snippet...

'I just captured the name of the addin I want toasted...
If Application.AddIns(sUserPpaMainName).Loaded = msoTrue Then
Application.AddIns(sUserPpaMainName).Loaded = msoFalse
DoEvents
Application.AddIns(sUserPpaMainName).AutoLoad = msoFalse
Application.AddIns.Remove sUserPpaMainFullPth
DoEvents
End If
Kill sUserPpaMainFullPth
'<choke - until I step through it.>
 
C

c mateland

I'm now seeing that any action of unloading/removing an addin prevents
killing the ppa file in the same procedure.

Yet, it seems obvious to me that I have to first unload/remove a ppa
from the addin list before killing the file. Right?

So, how do you, unload/remove the ppa addin and then kill the file?
 
C

c mateland

Steve said:
Can you rename it? If so, have your "control/update" ppa check for the renamed
file at startup and delete it then. That's assuming it and the replacement
you're loading have different filenames (perhaps a version number appended to
the regular filename)?

No, it's getting the same sort of error where it's a question of
timing. Once I restart the code, it runs fine. It's that the code stops
because it thinks it can't delete the file because it's tied up with
PowerPoint.

I saw in the Excel group a person suggested a loop where it keeps
trying to delete until it finally does, but I couldn't get that to
work. I think it finally gave up after a gazillion iterations.

This seems like it should be so simple yet I can't figure it out. I
just want to unload a ppa and then delete the file.
 
C

c mateland

Steve said:
Or

Instead of loading the PPA you need to replace from time to time, let your "loader"
addin load it for you. IOW:

PPT starts
Your "Loader" PPA autoruns
It checks for updated versions of Whatever.PPA
If it finds one, it copies it to the target folder
It loads Whatever.PPA (which is by now the updated one)

I think I follow you on this one, and I'm about to try it. Instead of
the subject ppa already being loaded (no autoload) the loader ppa
checks for newer version of the subject ppa and if one is found,
replaces the old one and then loads it (but no autoload). If a newer
subject ppa is not found then the existing one is loades, but again, no
autoload. This way, the subject ppa is never loaded at startup and
might then prevent the permission error when I go to kill it.

But I'm thinking somewhere will have to be an autoclose that removes
the subject ppa so that it isn't being used by PowerPoint at all upon
the next startup.

I'll let you know here in a few. Thanks.
 
C

c mateland

c said:
I think I follow you on this one, and I'm about to try it. Instead of
the subject ppa already being loaded (no autoload) the loader ppa
checks for newer version of the subject ppa and if one is found,
replaces the old one and then loads it (but no autoload). If a newer
subject ppa is not found then the existing one is loades, but again, no
autoload. This way, the subject ppa is never loaded at startup and
might then prevent the permission error when I go to kill it.

But I'm thinking somewhere will have to be an autoclose that removes
the subject ppa so that it isn't being used by PowerPoint at all upon
the next startup.

So far this is working. I'll have to conduct more tests to check other
scenarios, but so far so good. And I didn't need an autoclose to remove
the subject ppa. By using only the load statement (not autoload) it is
not installed upon the next startup of PowerPoint, so there's nothing
to remove.

If this continues to work with all my imagined scenarios, this will
enable me to change automation by changing the subject ppa in my
network folder and all users will pick it up just by opening PowerPoint
with the loader ppa installed. Does that make sense?

Also, do you see any reason to use an autoclose event? So far I haven't
had the need, but I want to be sure I'm not missing anything. Is it
common to incorporate an autoclose command?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top