View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike[_37_] Mike[_37_] is offline
external usenet poster
 
Posts: 20
Default 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?

also, in my workbook_addinunistall(), ctlTidy is nothing, it seems like I'm
setting the scope improperly, but it was working only 10 minutes ago
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)
__________________________________________________ __________________________
________________