ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Addin out of range error (https://www.excelbanter.com/excel-programming/337733-addin-out-range-error.html)

Trux

Addin out of range error
 
Thanks in advance for any assistance.

I am having a bit of trouble with add-ins.

I have a macro that, among other things, checks to see if a particular
add-in is installed and loaded into memory in Excel.

The problem is that if the add-in is not registered in the list of
available add-ins in the Tools-Addins menu it errors out in a subscript
out of error range.

I tried a number of ways to trap the error, none of which have been
successful.

Note: My code is neither clean nor pretty.

Examples:
dim myval as boolean

On Error Resume Next
If IsError(Application.AddIns("Unloaded Addin").Installed = True)
Then myval= false
---------------------------------
dim myval as boolean

If IsError(Application.AddIns("Unloaded Addin").Installed = True)
Then GoTo opt_out
' (other code


exit sub

opt_out:
myval = false
'return to main code
---------------------------------

Each of these generates the Run time error '9':Subscript out of range.

Any ideas on how to check this and not generate an error if the addin
isn't listed as "registered" with Excel?


Bob Phillips[_6_]

Addin out of range error
 
This works for me

Dim myval As Boolean
Dim addn As AddIn

myval = False
For Each addn In Application.AddIns
If LCase(addn.Name) = "unloaded addin.xla" Then
myval = addn.Installed
Exit For
End If
Next addn
MsgBox myval


--

HTH

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


"Trux" wrote in message
ups.com...
Thanks in advance for any assistance.

I am having a bit of trouble with add-ins.

I have a macro that, among other things, checks to see if a particular
add-in is installed and loaded into memory in Excel.

The problem is that if the add-in is not registered in the list of
available add-ins in the Tools-Addins menu it errors out in a subscript
out of error range.

I tried a number of ways to trap the error, none of which have been
successful.

Note: My code is neither clean nor pretty.

Examples:
dim myval as boolean

On Error Resume Next
If IsError(Application.AddIns("Unloaded Addin").Installed = True)
Then myval= false
---------------------------------
dim myval as boolean

If IsError(Application.AddIns("Unloaded Addin").Installed = True)
Then GoTo opt_out
' (other code


exit sub

opt_out:
myval = false
'return to main code
---------------------------------

Each of these generates the Run time error '9':Subscript out of range.

Any ideas on how to check this and not generate an error if the addin
isn't listed as "registered" with Excel?




Tom Ogilvy

Addin out of range error
 

dim myval as boolean
On Error Resume Next
Myval = Application.AddIns("Unloaded Addin").Installed
On Error goto 0

' at this point, if the addin is installed, then myval will equal True.
Otherwise, it is false

--
Regards,
Tom Ogilvy


"Trux" wrote in message
ups.com...
Thanks in advance for any assistance.

I am having a bit of trouble with add-ins.

I have a macro that, among other things, checks to see if a particular
add-in is installed and loaded into memory in Excel.

The problem is that if the add-in is not registered in the list of
available add-ins in the Tools-Addins menu it errors out in a subscript
out of error range.

I tried a number of ways to trap the error, none of which have been
successful.

Note: My code is neither clean nor pretty.

Examples:
dim myval as boolean

On Error Resume Next
If IsError(Application.AddIns("Unloaded Addin").Installed = True)
Then myval= false
---------------------------------
dim myval as boolean

If IsError(Application.AddIns("Unloaded Addin").Installed = True)
Then GoTo opt_out
' (other code


exit sub

opt_out:
myval = false
'return to main code
---------------------------------

Each of these generates the Run time error '9':Subscript out of range.

Any ideas on how to check this and not generate an error if the addin
isn't listed as "registered" with Excel?





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

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