View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] NoSpam@aol.com is offline
external usenet poster
 
Posts: 142
Default How to wait for addon to load

The addin does not have an Auto_Add routine. (I wrote the addin).
However, when I added the line:
AddIns("RollForm").Installed = True
to Workbook_Activate(), Excel called RollForm.xla!Auto_Add and I received a
message that it couldn't find it. So I added:
sub Auto_Add()
end sub
to the addin and the message went away.

I put a Stop statement in Auto_Add and opened the Workbook and Excel 2003
did call Auto_Add. Some other things did not work and I assumed I was
supposed to include code in Sub Auto_Add to handle something or other, but
I had no idea what.

Via Google, I found that when you use AddIns("AddinName").Installed = True,
excel calls the addin's Auto_Add function but I found nothing describing
the function. (See:
http://databaseforum.info/16/9/cd250ee5bc1819d2.html
http://www.mrexcel.com/forum/showthread.php?t=35553
http://support.microsoft.com/kb/291294

http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx

Several people mentioned that when they got the error they could
immediately step through the program with no errors. I also experienced
this which led me to think it might be a timing problem.

When I added the code you suggested to ThisWorkbook, Excel no longer seems
to call Auto_Add and everything works fine.

Prior to adding you code and when I had an Auto_Add routing which did
nothing, the error went away, the routine was called but there were all
sorts of other strange errors - example: The addin creates and writes a
text file, then closes it. In certain situations, it re-opens the file and
reads it. When Auto_Add was being called, it would fail in various ways
when it tried to re-open the file.

My addin is working fine now, but I would still like to understand why
Auto_Add is being called and what the developer is supposed to put in it.

Thanks for any insight.


On Tue, 22 Jun 2010 16:39:27 -0500, Dave Peterson
wrote:

Auto_Add is a procedure in that RollForm.xla addin.

I've never heard of that addin, so I don't have a guess what the procedure
actually does.

And it isn't one of the Auto run procedure names (Workbook_Open or Auto_Open)
that excel looks for when the workbook/addin is opened.

If the addin's project is unprotected, maybe you could look at the code?



On 06/22/2010 15:25, wrote:
Thanks for your reply. Your suggestion using OnTime works. Thank you.

I do have a question however. I found that, until I implemented your
solution, VB was calling "RollForm.xla!Auto_Add".

What is Auto_Add() for? What code should I put in it if I ever use it?
What does using your code keep it from calling AutoAdd()?

Thanks!!

On Tue, 22 Jun 2010 14:11:56 -0500, Dave Peterson
wrote:

Untested, but I'd try:

AddIns("RollForm").Installed = False
AddIns("RollForm").Installed = True

If that doesn't work, then maybe it is a timing issue.

You could use:

AddIns("RollForm").Installed = False
AddIns("RollForm").Installed = True
Application.OnTime Now + timeSerial(0,0,1), "Continue_Open"

End Sub

And the put the remainder of the code in that Continue_Open in a General module.


On 06/22/2010 13:57,
wrote:
In the ThisWorkbook module of a spreadsheet I have the statement:
AddIns("RollForm").Installed = True
The next line calls a sub in RollForm.xla.

The call fails because RollForm.xla is not yet loaded. If I step through
the code, it works fine.

How can I program a wait for RollForm.xla to be loaded?


Thanks!