Thread: Add_Ins
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gareth[_6_] Gareth[_6_] is offline
external usenet poster
 
Posts: 158
Default Add_Ins

Hi Bill,

An AddIn is just an easy and very neat means of deploying code. It is
ostensibly no different from opening a workbook with VBA code in it -
indeed it is just a special kind of workbook.

The third party AddIn must have had some code in it that adds a button
to the Tools menu. Clicking this button fires off one of the procedures
in the AddIn. (Again, this can be done for all workbooks - not just AddIns.)

To make procedures available on the Excel Toolbar you need to add them
when your AddIn is loaded.

Say you have a procedure in Module1 of your AddIn:

Sub SayHello()
msgbox "Hello"
End Sub

If you want to have a button for this, insert the below code into the
Thisworkbook code module (watch for wrapping)

Private Sub Workbook_Open()

Dim myButton As CommandBarControl

Set myButton =
Application.CommandBars(1).Controls("Tools").Contr ols.Add _
(Type:=msoControlButton, Temporary:=True) '
With myButton
.Caption = "&Click Me"
.OnAction = "SayHello"
.Style = msoButtonCaption
.BeginGroup = True
End With

End Sub

You can have as many buttons for as many procedures as you like. If you
want to make your own command bar see below link:
http://groups-beta.google.com/group/...062410666ba2b7


HTH,
Gareth

bill_morgan wrote:
I installed a 3rd party Add_In through Tools/Add_Ins/Browse ... and then
clicked OK. The new Add_In name now appears in the Tools drop down menu.

So far so good.

Then I created my own Add_In (.xla file). I followed the same procedure as
above, but my own Add_In does not appear in the Tools drop down menu even
though its box is checked in the Add_Ins Available dialog box.

What further steps do I need to take to get my new Add_In to appear in the
Tools drop down list?

Thanks for your help ...