Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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)
__________________________________________________ __________________________
________________



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default self-installing add-in?

Forget the part about
"Mike" wrote in message
...

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.



- I must have moved my declaration of ctlTidy into the wrong module when I
wasn't looking... teach me to hit send to soon.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default self-installing add-in?

Mike -

You didn't say what version of Excel you were working with, so this may not
apply.

I recently got bitten by a .xla that was part of a s/w package written by
some others in our company. The install for that package placed an .xla in
my C:\Program Files\Microsoft Office\Office10\XLStart folder and Excel was
starting it up every time Excel was opened - without it showing up in the
list of Add-Ins that you can access from the Tools menu button.

I don't know if there was a similar folder in earlier versions of Office,
but you might check this out.

Good luck!

James Cox


"Mike" wrote in message
...
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)

__________________________________________________ __________________________
________________





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default self-installing add-in?

Sorry James.... WinXP, XL2000...

I wasn't thinking about putting it in the XLStart folder (the thought didn't
cross my mind), I was just thinking of if there is a way to put it in the
Add-Ins list that you're talking about, that seems to me to be the 'proper'
way to install it.

But for the computer 'not-quite-savvy' users in my company who are going to
use this, telling them to 'save the .xla file in the C:\documents and
settings\your user name here\...\Add-Ins folder, then start excel, etc, etc'
doesn't really work for me.

However, that being said, I'm also limited to whatever I can get vba to do.
Or is this something that maybe I could find vbscript for?.... hmm... my
company's not the type to let a process engineer get their hands on a fancy
install program, so it's whatever I can create.

Thanks.

Mike.
--

__________________________________________________ __________________________
________________
Please reply to newsgroup so everyone can benefit.
Email address is not valid (see sparkingwire.com)
__________________________________________________ __________________________
________________
"James Cox" wrote in message
...
Mike -

You didn't say what version of Excel you were working with, so this may

not
apply.

I recently got bitten by a .xla that was part of a s/w package written by
some others in our company. The install for that package placed an .xla

in
my C:\Program Files\Microsoft Office\Office10\XLStart folder and Excel

was
starting it up every time Excel was opened - without it showing up in the
list of Add-Ins that you can access from the Tools menu button.

I don't know if there was a similar folder in earlier versions of Office,
but you might check this out.

Good luck!

James Cox


"Mike" wrote in message
...
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)


__________________________________________________ __________________________
________________







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default self-installing add-in?

Mike- I apologize, missed the beginning of this thread-

Do you need an XLA, or just for folks to have access to your procedures? I
ran into
something similar recently with MS Word, and used VBA to identify the word
template directory (which is different depending on what version of Word is
being
used). I created a template that I distributed, and when the _template_ was
opened,
it would check to see if it was in the template folder.

If the template found that is wasn't in the template folder, it made a copy
of itself in
the template folder, then closed (with a user instruction on how to open a
child
document from the new documents menu, instead of opening the template
itself)

I'm not sure if your users will need your procedures all the time, in which
case an
XLA might make more sense, or just sometimes, in which case you could
create
an XL file that would self install.... even if you used the same logic as
above I'd think
you could use VBA to get the XLA in an appropriate directory, but I've
never used
VBA to actually add an add-in dynamically (vs. manually) so someone else
would
have to help with the code for that (which I'll be lurking for :)

Keith R

Mike wrote in article
...
Sorry James.... WinXP, XL2000...

I wasn't thinking about putting it in the XLStart folder (the thought

didn't
cross my mind), I was just thinking of if there is a way to put it in the
Add-Ins list that you're talking about, that seems to me to be the

'proper'
way to install it.

But for the computer 'not-quite-savvy' users in my company who are going

to
use this, telling them to 'save the .xla file in the C:\documents and
settings\your user name here\...\Add-Ins folder, then start excel, etc,

etc'
doesn't really work for me.

However, that being said, I'm also limited to whatever I can get vba to

do.
Or is this something that maybe I could find vbscript for?.... hmm...

my
company's not the type to let a process engineer get their hands on a

fancy
install program, so it's whatever I can create.

Thanks.

Mike.
--






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default self-installing add-in?

Well Keith, I started thinking along your lines, which made the install go a
little bit nicer, but my problem continued to be that when I open the add-in
and it's not installed, which I then want it to install itself (which it
does), it cycles 160 times between the workbook_open and
workbook_addininstall procedures - I'm guessing that the problem is
something to do with it taking a certain amount of time for Excel to
register that the add-in is installed, and that amount of time happens to be
long enough for my add-in to say "hey, I'm not installed. I'll install
myself. When I install myself, I need to run InitButton to create my
button" 160 times.

Anyways, I just smartened up (as I was writing this), and realized that by
eliminating the call to initbutton in my _addininstall sub, that the
barone.worksheetbar (a commandbars class with events) takes care of adding
the button (if it's not there) through the _onchange event

You're welcome to this code snippet if you'd like (you mentioned you'd lurk
for something like it), it now rather nicely installs my add-in for me and
creates 1 (and only 1) copy of the button just by opening the xla file.
ctlTidy is a public commandbarbutton variable declared elsewhere, InitButton
is a function that creates & returns a button on the end of the
worksheetmenubar, and BarOne is defined as the class module that is at the
end of my code he

Private Sub Workbook_AddinUninstall()
Set BarOne.WorksheetBar = Nothing
ctlTidy.Delete
End Sub

Private Sub Workbook_AddinInstall()
End Sub

Private Sub Workbook_Open()
Set BarOne.WorksheetBar = Application.CommandBars
On Error GoTo Missing
If AddIns("tidyproductionreport").Installed = False Then
AddIns("tidyproductionreport").Installed = True
End If
Exit Sub

Missing:
If Err.Number = 9 Then 'if the addin is not in the addins list
'if no other workbook is open, create a new one so that excel will return
the addins collection,
'save the addin in the user's add-ins directory, add it to the add-in list
and install itself.
If Application.Workbooks.Count < 1 Then Application.Workbooks.Add
ThisWorkbook.SaveAs Filename:=Application.UserLibraryPath &
"TidyProductionReport.xla", addtomru:=False
AddIns.Add(ThisWorkbook.FullName).Installed = True
Resume
Else
Err.Raise Number:=Err.Number
Resume
End If
End Sub

from the class module that BarOne is declared as, because other programs our
company has floating around reset the menubar, though I'd rather do this
another way because having the _onupdate event going seems to cause some
flicker on the tool bars when you're moving your mouse (I guess the toolbars
update as you're moving the mouse to accomodate the new mouse position)

Option Explicit
Public WithEvents WorksheetBar As CommandBars

Private Sub WorksheetBar_OnUpdate()
Dim ctl
Dim done As Boolean

done = False

For Each ctl In WorksheetBar(1).Controls
If ctl.Caption = "Tidy PR" Then done = True
Next ctl
If (done = False) Then
Set ctlTidy = InitButton
End If
Set ctl = Nothing
End Sub

"Keith R" wrote in message
news:01c368a6$dab28be0$476a1bac@PC12001...

If the template found that is wasn't in the template folder, it made a

copy
of itself in
the template folder, then closed

....
I'd think
you could use VBA to get the XLA in an appropriate directory, but I've
never used
VBA to actually add an add-in dynamically (vs. manually) so someone else
would
have to help with the code for that (which I'll be lurking for :)

Keith R




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing vba CONVERTERS jimbo345 Excel Discussion (Misc queries) 1 April 8th 08 02:26 PM
installing XIRR jIM Excel Worksheet Functions 4 January 3rd 08 07:10 PM
Error when installing Add-ins Tinus Excel Discussion (Misc queries) 3 April 26th 05 06:16 PM
Installing MS Office [email protected] New Users to Excel 3 March 24th 05 04:29 PM
self installing macro Erymuzuan Mustapa Excel Programming 0 August 13th 03 11:05 AM


All times are GMT +1. The time now is 02:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"