problems with Add-In event procedures when moving WB files between computers

J

jon

We have written a complex Add-In (AI) which incorporates hidden internal
sheets and event procedures (EPs - I hope I'm using the right jargon here)
which are associated with "shapes" on the sheets.

When the user clicks on an AI-created menu entry, we create a new workbook
(WB) for him/her, by copying the internal sheets to the new WB. The result
is that, so long as the AI is still available, when the user clicks on the
shapes in their WB, EPs in the AI are triggered and do work for them.

Strangely, this even works if the AI is not installed: it seems as if the WB
knows the location of the AI file, and will auto load it even if the AI is
not explicitly installed or enabled. I'm not sure whether this is a bug or
a feature, but it is unexpected behavior.

This works fine on one computer. If you save the WB and then come back to
it later, the shapes continue to trigger the EPs correctly.

The problem occurs if you try to trade WBs with a co-worker. The names of
the EPs get corrupted on the second computer, having half of the path to the
AI from the first computer, and part from the second computer. It appears
that Excel is trying to "help" resolve these EP names when the file is
opened, but is totally screwing things up.

We've tried a variety of things to fix this, including trying to alter the
EP names at WB create time so that they look like either "macroname" or
"'addin-name.xla!'macroname", but the EP names continue to get corrupted by
the destination computer. We would fix the EP names at WB load time, only
we can't figure out how to do this (putting an EP inside the WB is not an
option, since it cannot be signed, and our customers often work at high
security levels).

I would be happy to provide more details to anyone who wants to work with me
on this.

Is there ANY way to allow users to trade WBs using this approach?

We're developing in Excel 97 and testing in 97, 2000, and 2002.

Thanks for listening.

Jon Bondy
jbondy at sover dot net
 
C

Charles Williams

Hi Jon,

sounds like your problem is that the shapes contain links to the subs in the
XLA.

Here are some approaches you could try:

- always install the addin in the same place (for instance C:\program
files\xyzco\addin.xla). You could force this with an install package.
- have your addin dynamically change the links in the workbook to itself
whenever an appropriate workbook is opened.
- dont use shapes that link to the addin, use menu/toolbar commands or
right-clicks or ...

You might find some of the ideas/code in my auto-reversioning add-in loader
useful (it handles changing links to revised versions of addins)
see http://www.DecisionModels.com/downloads.htm


regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm
 

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