Uninstalled .xla add in still runs?

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:
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
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
The macro assigned to the button includes a file path, so the file gets opened when you click it.
 
Upvote 0
so, this line
Code:
.OnAction = "TstHello"
is actually something more like
Code:
.OnAction = "Application.Run C:\Documents and Settings\UsrName\...\Hello World.xla!TstHello"
in the (pre-compiled?) code?
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,876
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top