Addin?

  • Thread starter Thread starter Doug Bell
  • Start date Start date
D

Doug Bell

Hi,
I am trying to create an XLA Addin that will Add a button to the toolbar
that when clicked will open a user Form etc.

I don't have any problem with the code to add the new button or the form or
its code but I am having trouble getting it to work as an addin.

I open an (existing) Excel Workbook and tick the new addin (that is shown)
in the Addin dialogue box.

After ticking the box I would like the Addin to run the code to add the new
toolbar button so I put this code into a sub called Autoexec but not only
does this not run but it is not shown in the list of Macros to manually fire
it.

I thought that it might not launch until the Workbook was re-opened but this
still did not launch it.

Am I doing something incorrect?

Doug
 
There is no such event as Autoexec. Maybe you we're thinking of Auto_Open().

Depending on approach, you can use the Workbook_Open event or the
Workbook_AddinInstall event.
 
Use the workbook's Open event os code the sub Auto_Open
to add the button or menu item.
Save the workbook as an xla.
when the xla opens, it should add the button/menu item
Be sure that you code the Auto_Close or the workbook's
Close event to remove any items it created.

Patrick Molloy
Microsoft Excel MVP
 
Rob & Patrick,

Thanks for your assitance, I have it working now.

It is a pity Microsoft VBA is not more functionaly standard across Microsoft
Applications. AutoExec as a sub launches as a startup macro in Access and
Word. Access Combo & List Boxes are quite different to the clunk Word boxes
and Forms have quite different events.

All exciting challenges, fortunately MS don't develop S/W for aircraft
systems!
 

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

Back
Top