Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Subscript error in 2007 when testing if Addin is installed

In Office 2007, I'm using the following function to determine whether an
Add-in is installed, but if the answer is "False", rather than false, I get
"Subscript out of range" error. Any idea what I'm doing wrong? How can I get
this to run right?

Private Function AddInInstalled(argName As String) As Boolean
'return true if an addin is installed:
If AddIns(argName).Installed = True Then
AddInInstalled = True
Else
AddInInstalled = False
End If
End Function

Thanks in advance...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Subscript error in 2007 when testing if Addin is installed

Is the error on the line

If AddIns(argName).Installed = True Then


If so, then try:

If cBool(AddIns(argName).Installed) = True Then


HTH,
Bernie
MS Excel MVP


"XP" wrote in message
...
In Office 2007, I'm using the following function to determine whether an
Add-in is installed, but if the answer is "False", rather than false, I get
"Subscript out of range" error. Any idea what I'm doing wrong? How can I get
this to run right?

Private Function AddInInstalled(argName As String) As Boolean
'return true if an addin is installed:
If AddIns(argName).Installed = True Then
AddInInstalled = True
Else
AddInInstalled = False
End If
End Function

Thanks in advance...



  #3   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Subscript error in 2007 when testing if Addin is installed

Hi Bernie and thanks.

That is the line where the error occurs, however your suggestion still fails
to prevent a subscript error if a "False" reply is generated...

Any other suggestions?

"Bernie Deitrick" wrote:

Is the error on the line

If AddIns(argName).Installed = True Then


If so, then try:

If cBool(AddIns(argName).Installed) = True Then


HTH,
Bernie
MS Excel MVP


"XP" wrote in message
...
In Office 2007, I'm using the following function to determine whether an
Add-in is installed, but if the answer is "False", rather than false, I get
"Subscript out of range" error. Any idea what I'm doing wrong? How can I get
this to run right?

Private Function AddInInstalled(argName As String) As Boolean
'return true if an addin is installed:
If AddIns(argName).Installed = True Then
AddInInstalled = True
Else
AddInInstalled = False
End If
End Function

Thanks in advance...




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Subscript error in 2007 when testing if Addin is installed

This worked ok in xl2003:

Option Explicit
Private Function AddInInstalled(argName As String) As Boolean
AddInInstalled = False
On Error Resume Next
AddInInstalled = CBool(Application.AddIns(argName).Installed)
On Error GoTo 0
End Function
Sub testme()
MsgBox AddInInstalled("analysis toolpak")
MsgBox AddInInstalled("qwer")
End Sub



XP wrote:

In Office 2007, I'm using the following function to determine whether an
Add-in is installed, but if the answer is "False", rather than false, I get
"Subscript out of range" error. Any idea what I'm doing wrong? How can I get
this to run right?

Private Function AddInInstalled(argName As String) As Boolean
'return true if an addin is installed:
If AddIns(argName).Installed = True Then
AddInInstalled = True
Else
AddInInstalled = False
End If
End Function

Thanks in advance...


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Subscript error in 2007 when testing if Addin is installed

Try it with an On Error trap control:

Sub TryNow()
MsgBox AddInInstalled("Analysis Toolpak")
MsgBox AddInInstalled("Fred")
End Sub

Private Function AddInInstalled(argName As String) As Boolean
'return true if an addin is installed:
Dim myName As String
AddInInstalled = False
On Error GoTo NotInstalled
myName = AddIns(argName).Name
AddInInstalled = AddIns(argName).Installed
NotInstalled:
End Function


HTH,
Bernie
MS Excel MVP


"XP" wrote in message
...
Hi Bernie and thanks.

That is the line where the error occurs, however your suggestion still fails
to prevent a subscript error if a "False" reply is generated...

Any other suggestions?

"Bernie Deitrick" wrote:

Is the error on the line

If AddIns(argName).Installed = True Then


If so, then try:

If cBool(AddIns(argName).Installed) = True Then


HTH,
Bernie
MS Excel MVP


"XP" wrote in message
...
In Office 2007, I'm using the following function to determine whether an
Add-in is installed, but if the answer is "False", rather than false, I get
"Subscript out of range" error. Any idea what I'm doing wrong? How can I get
this to run right?

Private Function AddInInstalled(argName As String) As Boolean
'return true if an addin is installed:
If AddIns(argName).Installed = True Then
AddInInstalled = True
Else
AddInInstalled = False
End If
End Function

Thanks in advance...








  #6   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Subscript error in 2007 when testing if Addin is installed

Thanks Dave and Bernie,

After trial and error, I also came up with something that works, FYI:

Private Function AddInInstalled(argAddInTitle As String) As Boolean
'return true if an addin is installed:
On Error GoTo xERR
If AddIns(argAddInTitle).Installed = True Then AddInInstalled = True
Exit Function
xERR: AddInInstalled = False
End Function

Thanks for your assistance.

"Dave Peterson" wrote:

This worked ok in xl2003:

Option Explicit
Private Function AddInInstalled(argName As String) As Boolean
AddInInstalled = False
On Error Resume Next
AddInInstalled = CBool(Application.AddIns(argName).Installed)
On Error GoTo 0
End Function
Sub testme()
MsgBox AddInInstalled("analysis toolpak")
MsgBox AddInInstalled("qwer")
End Sub



XP wrote:

In Office 2007, I'm using the following function to determine whether an
Add-in is installed, but if the answer is "False", rather than false, I get
"Subscript out of range" error. Any idea what I'm doing wrong? How can I get
this to run right?

Private Function AddInInstalled(argName As String) As Boolean
'return true if an addin is installed:
If AddIns(argName).Installed = True Then
AddInInstalled = True
Else
AddInInstalled = False
End If
End Function

Thanks in advance...


--

Dave Peterson

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
Installed Addin file opens when it shouldn't Aaron Excel Discussion (Misc queries) 3 February 6th 08 11:13 PM
subscript out of range error in Excel 2007 at Vista Feier Excel Programming 2 July 18th 07 05:20 AM
Unable to set installed property of addin polandjc Excel Programming 6 September 15th 05 02:29 PM
Testing for the presence of an AddIn? Maury Markowitz Excel Programming 3 April 1st 05 06:23 PM
Testing for an addin? Don Wiss Excel Programming 1 July 8th 04 04:10 AM


All times are GMT +1. The time now is 11:33 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"