ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use Toolbar Button to Toggle Addin (https://www.excelbanter.com/excel-programming/321816-use-toolbar-button-toggle-addin.html)

Rob

Use Toolbar Button to Toggle Addin
 
Hi, Is it possible to use VAB to load an addin via clicking a custom button
on the toolbar but if the addin is already loaded i.e. menu item showing,
unload the addin.

I tried the following without any luck other than it unloads the addin but
does load it

Sub load myaddin()
if application.addins("addin name") is nothing then
addins("addin name").installed = true
Else
addins("addin name").installed = False
End if
End sub



Lonnie M.

Use Toolbar Button to Toggle Addin
 
Hi, rob this worked for me:

Sub testAddIn()
If AddIns("Myaddins").Installed = False Then
MsgBox "Myaddins is not installed"
AddIns("Myaddins").Installed = True
MsgBox "Now it is"
Else
MsgBox "Myaddins is installed"
AddIns("Myaddins").Installed = False
MsgBox "Now it isn't"
End If
End Sub

HTH--Lonnie M.


Lonnie M.

Use Toolbar Button to Toggle Addin
 
Just to clarify, I should have said the following worked for me...


Bob Phillips[_6_]

Use Toolbar Button to Toggle Addin
 
How about simply

With Application.Addins("addin name")
.Installed = Not .Installed
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rob" wrote in message
...
Hi, Is it possible to use VAB to load an addin via clicking a custom

button
on the toolbar but if the addin is already loaded i.e. menu item showing,
unload the addin.

I tried the following without any luck other than it unloads the addin but
does load it

Sub load myaddin()
if application.addins("addin name") is nothing then
addins("addin name").installed = true
Else
addins("addin name").installed = False
End if
End sub





Rob

Use Toolbar Button to Toggle Addin
 
Lonnie - thanks for ideas.

Bob, very slick, brilliant use of code.

Thanks to you both. Rob

"Bob Phillips" wrote in message
...
How about simply

With Application.Addins("addin name")
.Installed = Not .Installed
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rob" wrote in message
...
Hi, Is it possible to use VAB to load an addin via clicking a custom

button
on the toolbar but if the addin is already loaded i.e. menu item showing,
unload the addin.

I tried the following without any luck other than it unloads the addin
but
does load it

Sub load myaddin()
if application.addins("addin name") is nothing then
addins("addin name").installed = true
Else
addins("addin name").installed = False
End if
End sub








All times are GMT +1. The time now is 01:33 AM.

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