How do I Add an Addin to Toolbar

  • Thread starter Thread starter Xispo
  • Start date Start date
X

Xispo

If I have an excel addin stored on a lan, is it possible to send
everyone at work a workbook with a macro in it, or is there easy way of
creating an exe, so that the excel addin is set up automatically in
their standard toolbar permanently (Eg the same menu as file, edit
etc.)

Thanks
 
I think the below code will acomplish part of your goal.
You wont be able to send it through E-mail in a file but
you can put this in a Workbook that is in the same
directory than the AddIn and call it install.xls or
similar you can instruct your users to launch it from that
directory. It should properly install the AddIn from that
location in the users Add-In selection. It will also
address the issue of the network location beeing a
different drive for different users.

Public Sub Auto_Open()
Dim MyAddIn As AddIn
Dim MyAddInName As String
Dim TempName
Dim i As Integer
Dim StartFolder As String

'Change this to your Add-ins file name
MyAddInName = "My Add-In.xla"
On Error GoTo ErrorMsg

If CInt(Application.Version) < 9 Then
MsgBox "This Add-In is designed for Excel 2000 or
higher, and cannot be installed with this Version of
Excel.", 48
Application.Quit
End If

For i = 1 To AddIns.Count
If InStr(1, AddIns(i).Name, MyAddInName,
vbTextCompare) > 0 Then
If AddIns(i).Installed = True Then
TempName = AddIns(i).Title
GoTo TheEnd
End If
End If
Next

StartFolder = ThisWorkbook.Path
StartFolder = StartFolder + "\" + MyAddInName
Set MyAddIn = AddIns.Add(Filename:=StartFolder,
CopyFile:=False)
TempName = MyAddIn.Title
MyAddIn.Installed = True

TheEnd:
MsgBox TempName + " has been installed successfully,
select OK to finish.", 64
Application.Quit
Exit Sub

ErrorMsg:
MsgBox "Sorry, an Error occured during the
installation.", 48
Application.Quit

End Sub
 
Back
Top