ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   self-installing add-in? (https://www.excelbanter.com/excel-programming/274877-self-installing-add.html)

Mike[_37_]

self-installing add-in?
 
Hello all...

I was wondering, as i've created an add-in to distribute to a few (not very
computer savvy) colleagues at my office, how to properly install the add-in
....

I tried putting

if addins("myaddin").installed = false then addins("myaddin").installed =
true

in the workbook open sub, thinking that then my colleagues can just
double-click on the xla file to open it and have it self-install. And it
works! complete with 40 or so loops through the workbook_open() and
workbook_addininstall() subroutines.... and of course, that's a problem
because the workbook_addininstall() sub adds a button to the worksheet menu
bar, so 40 loops = 40 new buttons tacked on (visually, not all that
appealing for the end-user).

It seems like you have to wait or something for the addins collection to
list the add-in as installed?

Anyone know what I'm doing wrong?

TIA.

Option Explicit
Public ctlTidy As CommandBarButton
Dim BarOne As New clsToolbar


Private Sub Workbook_AddinInstall()
Set ctlTidy = InitButton ' initbutton is a function that returns a
commandbarbutton object
End Sub

Private Sub Workbook_AddinUninstall()
Set BarOne.WorksheetBar = Nothing
On Error Resume Next
ctlTidy.Delete
On Error GoTo 0
End Sub

Private Sub Workbook_Open()
Set BarOne.WorksheetBar = Application.CommandBars

If AddIns("tidyproductionreport").Installed = False Then
AddIns("tidyproductionreport").Installed = True


End Sub


TIA

--

__________________________________________________ __________________________
________________
Please reply to newsgroup so everyone can benefit.
Email address is not valid (see sparkingwire.com)
__________________________________________________ __________________________
________________






All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com