Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Distributing toolbar

  Asked By: Phil    Date: Sep 12    Category: MS Office    Views: 622
  

I have a workbbok in which I have written some macros. Afterwards, I have
created a toolbar and have assigned some macros to it. Now I want to distribute
this workbook's toolbar functionality to other users. How could I perform the
same?
I have tried it by creating an Add-In but when I install this Add-In, I do not
find the toolbar in new workbook.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Adalhelm Fischer     Answered On: Sep 12

In the VBA IDE, go into the project explorer, under the add-in  project, Excel
Objects, "This Workbook", Workbook_Open event, place your code to create and
populate the toolbar. Then in Excel, Tools -> Add-Ins, make sure you have your
add-in selected. Whenever you load Excel, the toolbar  should be visible.

Example toolbar code that would create a toolbar with a single "start" button
would look something like this:

Dim StartButton as CommandBarButton
Application.Commandbars.Add(Name:="MyAddin", temporary:=True).Visible = True

Set StartButton = Application.CommandBars("MyAddin").Controls.Add _
(Type:=msoControlButton, ID:=2950, temporary:=True)
With StartButton
.Style = msoButtonCaption
.Caption = "Start"
.OnAction = "MyStartRoutine"
.ToolTipText = "Start my custom addin"
End With

Application.CommandBars("MyAddin").Position = msoBarTop

In a module in your addin, you would need a sub called "MyStartRoutine" that
will execute when you click on the "Start" button on your toolbar.

 
Didn't find what you were looking for? Find more on Distributing toolbar Or get search suggestion and latest updates.




Tagged: