LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Problems checking for an Addin

I use the below code to check for an AddIn, the problem I have is the line
marked * sometimes causes an if the file is missing, but sometime the error
code is ZERO, even though the file is not installed.

I have not quite worked out what is going on, but this line seems to be
inconsistant in its result.


Dim WBName As String
On Error Resume Next ' turn off error checking
* WBName = Workbooks(DCMaster2).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.
On Error Resume Next
Application.DisplayAlerts = False
With AddIns.Add(FileName:=Application.UserLibraryPath & DCMaster2)
.Installed = False
End With
With AddIns.Add(FileName:=Application.UserLibraryPath & DCMaster2)
.Installed = True
End With
Application.DisplayAlerts = True
LastError = Err
On Error GoTo 0 ' restore error checking
If LastError < 0 Then
' The workbook was not found in the correct location
AddinPresent = False
Else
' The workbook was found and installed
AddinPresent = True
End If
Else
' No error so the workbook is already loaded
AddinPresent = True
End If
End Function



--
Trefor
 
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
addin problems Brian Z Excel Programming 0 October 14th 04 05:41 PM
Problems with AddIn Installation Stephen Bullen[_3_] Excel Programming 0 June 24th 04 01:07 AM
AddIn installation Problems ale036 Excel Programming 0 June 22nd 04 07:37 PM
AddIn installation Problems cescobar Excel Programming 0 June 22nd 04 07:36 PM
Problems with Excel Com Addin Chip Pearson Excel Programming 1 August 9th 03 10:11 AM


All times are GMT +1. The time now is 10:04 AM.

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

About Us

"It's about Microsoft Excel"