Loading Addin with VBA

C

Carlg

I have written code to unload Addin "Test". Then I do a filecopy to
the addin default folder. That works well. I then do:

AddIns.Add("c:\defaultPath\test.ppa").Loaded = True

This errors out with a runtime error '2147188160 (80048240):
Addins (unknown Number): Invalid request. Named Addin not found.

I go into debug mode and can step through it without error. If I have
another addin loaded and just do a i = addins.count right before the
loaded = true line it does not error out.

Any thoughts what is wrong or how to work around this?

PPT 2003 SP2


Carl
 
C

Carlg

Steve,

Thanks for your response. The count line did not work all the time.
I have entered the lines you suggested and so far it has not given
another error? I did not mention the original file is stored on a
server and copied to C:\... so that is at least part of the delay. Is
there a way to pause code to allow loading? Or preferably, is there a
way to verify the load is complete? I guess I could use "Do Until"
with fileexists = false on the file. I have a similar problem with
deleting an addin then replacing it by copying the new revised addin
to the same location. I have not found a way to verify the delete is
complete before starting the copy.
 
C

Carlg

Steve,

Thanks for the link to sleep! It seems to have fixed the copy issue.
However my delete code is now giving me a permission denied error. If
I break before the delete then step through it, it works every time.
If I try the delete routine again it works every time. If I step
through the delete routine it works the first time. I just read
through a post and they mentioned Norton Antivirus as a cause for
someone else. I am not running Norton.

I have tried a fileobject.delete and the filedelete with the file
system??

Any thoughts?

Carl
 
C

Carlg

Thanks for the link to sleep! It seems to have fixed the copy issue.
However my delete code is now giving me a permission denied error. If
I break before the delete then step through it, it works every time.
If I try the delete routine again it works every time. If I step
through the delete routine it works the first time. I just read
through a post and they mentioned Norton Antivirus as a cause for
someone else. I am not running Norton.

As I mentioned earlier, PPT tends to hang onto files for dear life once it's opened
them. You might want to set some kind of flag in an external ini file or the registry
and have your code check that at PPT startup and if need be, delete any files then.




I have tried a fileobject.delete and the filedelete with the file
system??
Any thoughts?
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

Steve,

I figured out the problem. I was not setting the file object =
nothing as I should have been. I went out and found some examples
and went duh! Thanks for your help.


Carl
 
C

Carlg

Ah! Thanks for getting back with that.

I don't use FSO so I've never run into that one. Good to know.
I think I'll keep not using FSO. <g>

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

Steve,

Well this problem has continued to confuse me. Yesterday setting FSO
to nothing seemed to fix it, however that was not really the case. It
appears as you have mentioned PPT does not want to let go of the addin
file. Again, I believe I have solved the problem by moving the delete
step to the close event. Time will tell if this has really solved the
problem. Another option I am considering is using a batch file to
delete the file if this does not prove a solution.

Carl
 

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