ChrisOswald
Active Member
- Joined
- Jan 19, 2010
- Messages
- 454
I'm playing around with code to see what (.xla) addin's are installed on my computer, when they were made, etc. Anyway, I have a hello world addin that launches from the add in's tab (xl2007). It works, but it isn't actually installed. (Apparently when I was originally playing around with this add-in, the workbook uninstall event wasn't correct.) The Hello World.xla doesn't show up in the VBE project explorer when Excel is launched, but it does appear after the control is selected.
My questions are: How does Excel keep track of what file creates what control (to run what code)? Is there a way to capture this? Are there any other things I should be aware of?
Full Code:
Workbook module
Code module (it's a doozy )
My questions are: How does Excel keep track of what file creates what control (to run what code)? Is there a way to capture this? Are there any other things I should be aware of?
Full Code:
Workbook module
Code:
Private Sub Workbook_AddinInstall()
Dim cmbBar As CommandBar
Dim cmbControl As CommandBarControl
Set cmbBar = Application.CommandBars("Worksheet Menu Bar")
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlPopup, temporary:=False)
With cmbControl
.Caption = "Hello World"
With .Controls.Add(Type:=msoControlButton)
.Caption = "Hello World"
.OnAction = "TstHello"
End With
End With
End Sub
Private Sub Workbook_AddinUninstall()
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("Hello World").Delete
End Sub
Code module (it's a doozy )
Code:
Sub TstHello()
MsgBox ("Hello " & Application.UserName)
End Sub