Addins are sometimes loaded, sometimes not

  • Thread starter Michael G. Schneider
  • Start date
M

Michael G. Schneider

In an Excel file two AddIns are used. These are the "Analysis Functions" and
"Analysis Functions - VBA" AddIns (maybe wrong name, translated from
German).

If the Excel file is opened by the user directly, anything works fine.
However, if the file is opened (on the same PC, by the same user) via a VB
dotnet program, the AddIns cannot be used directly. They have to be loaded
by code.

One more observation...

Suppose the VB program has started Excel and loaded the file. Now, if you
then open the menu command "Tools >> AddIns" (maybe wrong name, translated
from German), the two AddIns are selected. You have to remove those
selections, close the dialog, open the dialog again, and set the selections.
Only then the AddIns can be used.

However, there are also situations where an Excel file is opened from a VB
program and the AddIns are available immediately. I do not see any clue, why
this works sometimes but not all the times.

Michael G. Schneider
 
D

Dave Peterson

That's the way excel works--when you're starting mechanically via your code,
maybe you can open the addin in the code, too???
 
M

Michael G. Schneider

Dave Peterson said:
That's the way excel works--when you're starting mechanically via your
code,
maybe you can open the addin in the code, too???

Thanks a lot for the answer.

I do not quite understand the "that's the way excel works". Why does it make
a difference, if Excel is started by a user by double clicking the
Excel-EXE, or if Excel is started by Automation by a VB dotnet program.

Yes, I can load the AddIn by code. I just wonder, why it is necessary at
all.

Michael G. Schneider
 
D

Dave Peterson

Just my guess (I have no real knowledge of why MS does anything).

I'm guessing that MS thought that if you were running excel via automation, then
it wouldn't be a good idea to start all the addins (or files in the XLStart
folder).

Maybe they thought it would save time. Maybe they thought that there could be
some user interaction that would have to be avoided (dismiss a message box???)
in automation mode.
 
M

Michael G. Schneider

Dave Peterson said:
Just my guess (I have no real knowledge of why MS does anything).

I'm guessing that MS thought that if you were running excel via
automation,
then it wouldn't be a good idea to start all the addins (or files in the
XLStart
folder).

Maybe they thought it would save time. Maybe they thought that there
could
be some user interaction that would have to be avoided (dismiss a message
box???) in automation mode.

Doing anything in Automation should have the same results as if you did this
manually. Just imagine that you record some macros, and when you replay them
they don't work. You also expect anything done via code to be the same as if
done via keyboard.

Michael G. Schneider
 
D

Dave Peterson

If I were automating excel from another program, I may not want to have any
interaction with excel. I could keep the application hidden so that I (or the
other users) don't even know that excel is doing something in the background.

If I (or another user) had an addin that welcomed me to excel and waited for a
response, then my automated routine would never work.

And if I load those addins while I'm automating excel, then I can use the
recorded macros. But I'm glad MS made it the way they did. Otherwise, who
knows what kind of addins could be loaded and started--and any automated excel
procedure may not work as intended.
 
M

Michael G. Schneider

If I were automating excel from another program, I may not want to have
any
interaction with excel. I could keep the application hidden so that I (or
the
other users) don't even know that excel is doing something in the
background.

If I (or another user) had an addin that welcomed me to excel and waited
for a
response, then my automated routine would never work.

And if I load those addins while I'm automating excel, then I can use the
recorded macros. But I'm glad MS made it the way they did. Otherwise,
who
knows what kind of addins could be loaded and started--and any automated
excel
procedure may not work as intended.

Thanks a lot for the answer.

So, I understand that MS Excel never loads AddIns automatically, if Excel is
started by Automation. This is ok, if it always is that way. However, I
think during my tests I sometimes had situations, where the AddIns were
loaded automatically - but I will try to verify that.

Michael G. Schneider
 

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