ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   =Why AddIns.Installed can be out of range= (https://www.excelbanter.com/excel-programming/310772-re-%3Dwhy-addins-installed-can-out-range%3D.html)

Tom Ogilvy

=Why AddIns.Installed can be out of range=
 
Sub BBBB()
If AddIns("Analysis ToolPak").Installed = False Then
MsgBox "Analysis ToolPak is not installed"
End If
End Sub

Worked fine for me as did
? application.AddIns("Analysis Toolpak").Name
ANALYS32.XLL


--
Regards,
Tom Ogilvy

"hcova" wrote in message
...
I am trying to verify if the Analysis Tollpak is installed with the

following
sentence:

If AddIns("Analysis ToolPak").Installed = False Then
MsgBox "Analysis ToolPak is not installed"
End If

The problem is that I receive a error when I run this code. In the first
line, VBA stops telling me "Subindex out of interval", making reference to
the string argument.
If I replace the argument of the AddIns property by for example an 1, I
donīt receive the error box. It works!!. However, if you check the online
help there are many examples where the AddIns property can accept strings

and
numbers as argument.
Where I am making the error?








jenelle

AddIns.Installed out of range or not installable...
 
Tom,
You're my hero if you can explain what I missed in the following code. On
Set wbMyAddin line, user is getting error 1004: analys32.xll could not be
found....
Doing F8 to step thru shows error on preceding Set command is 9 (not open).

Sub AddinTest()
' Add and install this addin
' On Error Resume Next ' turn off error checking
Set wbMyAddin = Workbooks(AddIns("Analysis ToolPak").Name)
lastError = Err
On Error GoTo 0 ' restore error checking
If lastError < 0 Then ' the add-in workbook isn't currently open.
Manually open it.
Set wbMyAddin = Workbooks.Open(AddIns("Analysis ToolPak").FullName)
End If
End Sub





"Tom Ogilvy" wrote:

Sub BBBB()
If AddIns("Analysis ToolPak").Installed = False Then
MsgBox "Analysis ToolPak is not installed"
End If
End Sub

Worked fine for me as did
? application.AddIns("Analysis Toolpak").Name
ANALYS32.XLL


--
Regards,
Tom Ogilvy

"hcova" wrote in message
...
I am trying to verify if the Analysis Tollpak is installed with the

following
sentence:

If AddIns("Analysis ToolPak").Installed = False Then
MsgBox "Analysis ToolPak is not installed"
End If

The problem is that I receive a error when I run this code. In the first
line, VBA stops telling me "Subindex out of interval", making reference to
the string argument.
If I replace the argument of the AddIns property by for example an 1, I
donÂīt receive the error box. It works!!. However, if you check the online
help there are many examples where the AddIns property can accept strings

and
numbers as argument.
Where I am making the error?









Fredrik Wahlgren

AddIns.Installed out of range or not installable...
 

"jenelle" wrote in message
...
Tom,
You're my hero if you can explain what I missed in the following code. On
Set wbMyAddin line, user is getting error 1004: analys32.xll could not be
found....
Doing F8 to step thru shows error on preceding Set command is 9 (not

open).

Sub AddinTest()
' Add and install this addin
' On Error Resume Next ' turn off error checking
Set wbMyAddin = Workbooks(AddIns("Analysis ToolPak").Name)
lastError = Err
On Error GoTo 0 ' restore error checking
If lastError < 0 Then ' the add-in workbook isn't currently

open.
Manually open it.
Set wbMyAddin = Workbooks.Open(AddIns("Analysis

ToolPak").FullName)
End If
End Sub

Maybe you have a non english version of Excel. Have you tried to activate
the analysis toolpak manually? What name was displayed? You can turn on the
macro recorder before you do this, that will show you the name.

/Fredrik




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

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