Reusable ActiveX button?

  • Thread starter Thread starter MikeT
  • Start date Start date
M

MikeT

I made a button to analyze data in a pivot table. My customer liked it so
much they want to be able to use it in a lot of different workbooks.

Is there a way to save off just the button and the VBA code behind it? I
want people to be able to open a workbook, then add this button to the active
sheet themselves and then do the analysis.
 
You are probably best off with an addin. They are similar to macros stored in
your personal workbook but they can be distributed relatively easily. Here is
a quick primer on addins. Additional to that I would be inclined to create a
custom toolbar from the addin to put your button on.

http://www.cpearson.com/excel/CreateAddIn.aspx
 
Not really.

But if I needed this, I wouldn't want the code duplicated in tons of other
workbooks. Instead, I think I'd create an addin that added a button to a
toolbar (even a new toolbar). Then I could use this single addin whenever I
wanted to do that analysis.

I'm not sure what your code does, but you may have to generalize it a bit--use
ActiveSheet instead of a specific worksheet name--activeworkbook instead of the
name of the workbook--pivottable(1) instead of a particular name.

=========
You may want to look at how Debra Dalgleish approached this with her pivottable
addin.
http://www.contextures.com/xlPivotAddIn.html
and
http://www.contextures.com/xlPivotAddIn02.html

=========

Saved from a previous post:

Your life will become much simpler if you include code to create the toolbar
when the workbook is opened and include code to destroy the toolbar when the
workbook is closed.

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

In xl2007, those toolbars and menu modifications will show up under the addins.

And if you use xl2007:

If you want to learn about modifying the ribbon, you can start at Ron de Bruin's
site:
http://www.rondebruin.nl/ribbon.htm
http://www.rondebruin.nl/qat.htm -- For macros for all workbooks (saved as an
addin)
or
http://www.rondebruin.nl/2007addin.htm
 
Back
Top