add-in?

  • Thread starter Thread starter Steph
  • Start date Start date
S

Steph

Hi. I was trying to create a file that I could send out to a department
that would be a sort of add-in (probably a bad choice of words). Basically,
I want the receiver to double click on the file, and have it automatically
create a new menu button, and under that a custom menu item, and finally
assign a macro to the new menu item. I can do it manually, but can it be
done in code in such a way the file auto-installs the menu item? Thanks!
 
Hi
put this code in the workbook_open event of your addin file. This way
the code gets started then installing the addin
 
Hi
I thought you already have some code for adding menu items, etc.
 
I would also suggest that when closing the add-in, it removes the changes made
to the menu. Otherwise, you'll get multiple buttons/menu items, no?
 
Steph,

Put this in the "Thisworkbook" module:

Option Explicit

Private Sub Workbook_Open()
Dim objItem As Object
Set objItem = Application.CommandBars.ActiveMenuBar
Set objItem = objItem.Controls.Add(Type:=msoControlPopup, Temporary:=True)
objItem.Caption = "Make Report"

Set objItem = objItem.Controls.Add(Type:=msoControlButton)
objItem.Caption = "The Steph Report"
objItem.OnAction = "procMakeReport"
End Sub

*****************************

Put this in Module1

Option Explicit

Sub procMakeReport()
MsgBox "Create the report...", vbInformation, "The Steph Report"
End Sub

This will get you going.

Dale Preuss
 

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