How to: Customize a Toolbar to launch an Addin

  • Thread starter Thread starter Rob Diamant
  • Start date Start date
Rob said:
Does anyone have any suggestions?

Create a public function in a standard module with this line of code:

Application.CommandBars("Tools").Controls("Add-Ins").Controls("NameOfAdd-
In").accDoDefaultAction

Create a custom button on your toolbar with the OnAction property like this:

=NameOfFunction()

Make sure there are no spaces. There must be an equals sign at the beginning
and there must be open and close parentheses at the end.
 
Looks good, I will give it a try. But does this mean I need to put this code
in every database I have? At last check I have over 400 databases.

Rob
 
Rob said:
But does this mean I need to put this code
in every database I have?

No. The user can click on the built-in menu to launch the Add-In. But with
the custom toolbar, it sounded like you wanted to avoid showing the built-in
menu.
At last check I have over 400 databases.

You probably have a lot of redundant databases. Suggest you consider
consolidating to protect your sanity.
 
Thanks, but my sanity has always been in question.

Unfortunatly, these are all different customer databases (SQL Server or
Oracle) that I need to link to. I built a nice little form to standardize my
linking process as an AddIn. But I wanted to launch the Addid from a button
on the tool bar (since I use this all the time) instead of having to step
through menus. Too bad Access does not have a "Startup" like the
Personal.XLS in Excel or does it?

Rob
 
Rob said:
But I wanted to launch the Addid from a button
on the tool bar (since I use this all the time) instead of having to step
through menus.

You could put the public function in a library, then add the library as a
reference, but that would be a maintenance nightmare.

Do this: customize your built-in menu. In *customize* mode, hold the <CTRL>
key down and drag the name of your Add-in up to the top of the Tools menu
(above "Spelling...") to make a copy of the menu item. It won't be a custom
toolbar button, but it will prevent you from having to import code into every
database, and menu navigation will be minimal for every database you open on
that computer.
Too bad Access does not have a "Startup" like the
Personal.XLS in Excel or does it?

If you create a template database that has common libraries, functions,
settings, forms, reports, etc. and create each new database from this
template file, then you'll have a similar function. The downside to this is
that if you want to change something, it doesn't propagate to the already
created databases. You'd have to open each database individually and
manually make the change. Maintenance nightmare.
 

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