Linking a workbook to an add-in

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you link a workbook to an add-in? Here's what I'd like to do.

After opening a new workbook, a user can select an add-in (from tools/add-ins). This would
a) do some initializations and b) link this particular workbook with the add-in. When reopening the same workbook, the add in would still be available. This would of course apply to any number of workbooks where the procedure is followed.

On the other hand, if on another workbook the add-in wasn't selected, all the initializations, etc. wouldn't take place.

Thanks

Julio
 
I am not sure I am following you.

Assuming you want your add-in to remember the last workbook to which the
add-in was applied:
Create a name in your add-in - provided you want to memorize one
workbook - and write the workbook's name to that value.
Alternatively, you can create a range in your add-in which would contain
the list of all workbooks ever processed by this add-in.

Assuming you want an add-in to be available only when a certain workbook is
open:
Add the add-in's activation code to the workbook's Workbook_Open event.

I re-read and re-read your message and still can make very little out of
it.... In fact, you're describing two add-ins:

1) Add-in A - is activated when the user opens up Excel and adds a menu
item in the tools/add-ins section. When the user activates it, it attaches
Add-In B to the active workbook so that add-in B automatically becomes
available when this workbook is opened.
2) Add-in B - this one is the actual add-in which contains all
processing code.

Hence, it seems you may want to choose the latter option that I described
above.

Cheers,

FK

Julio Kuplinsky said:
How do you link a workbook to an add-in? Here's what I'd like to do.

After opening a new workbook, a user can select an add-in (from tools/add-ins). This would
a) do some initializations and b) link this particular workbook with the
add-in. When reopening the same workbook, the add in would still be
available. This would of course apply to any number of workbooks where the
procedure is followed.
On the other hand, if on another workbook the add-in wasn't selected, all
the initializations, etc. wouldn't take place.
 
Let's put it this way. Suppose that the add-in contains utilities to process students' grades (averages, whatnot). If I open a new workbook to enter Course A's grades, I want the utilites to initialize some supporting worksheets. Of course, when I enter the final grades, the utilities should still be available. Same story for Course B.

Now, obviously, if I open a workbook to enter my expenses, I dont need the student grades utiliites, nor do i need the supporting spreadsheets.

Thanks
Julio
 
Okay, then why not create an add-in named 'coursegrades' which would contain
all of the grades for all of your courses and also contain all of the code -
an all-around self-containing add-in? Or a template?

Examples of such a template, which are in fact is add-ins, - are Microsoft's
mortgage calculator and small business invoice templates which come with
Excel.

Cheers,
FK



Julio Kuplinsky said:
Let's put it this way. Suppose that the add-in contains utilities to
process students' grades (averages, whatnot). If I open a new workbook to
enter Course A's grades, I want the utilites to initialize some supporting
worksheets. Of course, when I enter the final grades, the utilities should
still be available. Same story for Course B.
Now, obviously, if I open a workbook to enter my expenses, I dont need the
student grades utiliites, nor do i need the supporting spreadsheets.
 
Back
Top