Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how to know if a xla is 'loaded'

Hi to all,

I search how to know if an a reference to a xla file is active, in a xls
file.

Do you have some advice ?

thks a lot

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default how to know if a xla is 'loaded'

Hi Isabelle,

There is an addins collection that you can test. This returns all addins
available to Excel, so you need to test the installed property, like so

For Each oai In Application.AddIns
If oai.Installed = True Then
Debug.Print oai.Name
End If
Next


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Isabelle Robin" wrote in message
...
Hi to all,

I search how to know if an a reference to a xla file is active, in a xls
file.

Do you have some advice ?

thks a lot



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how to know if a xla is 'loaded'

Hi,

In fact I have created a xla file and now an excel file has a reference to
this xla file.
With your code, I only see (I think) the installed addins.
But with my xla file, I have done nothing so I can't see it.
The goal is that some people, when they will have access to this xla file,
will have all buttons visible, instead of other people, if they don't have
this xla file, some button will be invisible.
So my question could me : how can I know the checked references in the Tools
menu.

thanks for your answer

Bob Phillips wrote:

Hi Isabelle,

There is an addins collection that you can test. This returns all addins
available to Excel, so you need to test the installed property, like so

For Each oai In Application.AddIns
If oai.Installed = True Then
Debug.Print oai.Name
End If
Next

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Isabelle Robin" wrote in message
...
Hi to all,

I search how to know if an a reference to a xla file is active, in a xls
file.

Do you have some advice ?

thks a lot


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default how to know if a xla is 'loaded'

If you want to know whether an XLA file has been opened either by the addin
manager or some other means use

Dim oAdd as workbook
set oAdd=nothing
on error resume next
set oadd=workbooks("Myaddin.XLA")
on error goto 0
if oadd is nothing then msgbox "Myaddin.xla not loaded"

If you want to know what references are to the XLA are valid in the VBE you
need to add a reference to the VBA extensibility library and look at the
references property of your project

regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

"Isabelle Robin" wrote in message
...
Hi to all,

I search how to know if an a reference to a xla file is active, in a xls
file.

Do you have some advice ?

thks a lot



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how to know if a xla is 'loaded'

Hi to all,

I found the solution :

Private Sub Workbook_Open()
If CommonExist("common") Then
MsgBox "common exists"
Else
MsgBox "comon doesn't exists"
End If
End Sub

Function CommonExist(refName As String)
CommonExist = False
For Each objReferences In Workbooks("1.xls").VBProject.References
If LCase(objReferences.Name) = refName Then
CommonExist = True
End If
Next objReferences
End Function

Best regards

Isabelle Robin wrote:

Hi,

In fact I have created a xla file and now an excel file has a reference to
this xla file.
With your code, I only see (I think) the installed addins.
But with my xla file, I have done nothing so I can't see it.
The goal is that some people, when they will have access to this xla file,
will have all buttons visible, instead of other people, if they don't have
this xla file, some button will be invisible.
So my question could me : how can I know the checked references in the Tools
menu.

thanks for your answer

Bob Phillips wrote:

Hi Isabelle,

There is an addins collection that you can test. This returns all addins
available to Excel, so you need to test the installed property, like so

For Each oai In Application.AddIns
If oai.Installed = True Then
Debug.Print oai.Name
End If
Next

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Isabelle Robin" wrote in message
...
Hi to all,

I search how to know if an a reference to a xla file is active, in a xls
file.

Do you have some advice ?

thks a lot




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default how to know if a xla is 'loaded'

Isabele,

You might want to add some error handling in case the workbook doesn't
exist, but more importantly, if you downshift one side of a test, you should
also downshift the other side

Function CommonExist(refName As String)
Dim objReferences
CommonExist = False
On Error GoTo exit_function
For Each objReferences In Workbooks("1.xls").VBProject.References
If Err.Number = 0 Then
If LCase(objReferences.Name) = LCase(refName) Then
CommonExist = True
End If
End If
Next objReferences
exit_function:
End Function

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Isabelle Robin" wrote in message
...
Hi to all,

I found the solution :

Private Sub Workbook_Open()
If CommonExist("common") Then
MsgBox "common exists"
Else
MsgBox "comon doesn't exists"
End If
End Sub

Function CommonExist(refName As String)
CommonExist = False
For Each objReferences In Workbooks("1.xls").VBProject.References
If LCase(objReferences.Name) = refName Then
CommonExist = True
End If
Next objReferences
End Function

Best regards

Isabelle Robin wrote:

Hi,

In fact I have created a xla file and now an excel file has a reference

to
this xla file.
With your code, I only see (I think) the installed addins.
But with my xla file, I have done nothing so I can't see it.
The goal is that some people, when they will have access to this xla

file,
will have all buttons visible, instead of other people, if they don't

have
this xla file, some button will be invisible.
So my question could me : how can I know the checked references in the

Tools
menu.

thanks for your answer

Bob Phillips wrote:

Hi Isabelle,

There is an addins collection that you can test. This returns all

addins
available to Excel, so you need to test the installed property, like

so

For Each oai In Application.AddIns
If oai.Installed = True Then
Debug.Print oai.Name
End If
Next

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Isabelle Robin" wrote in message
...
Hi to all,

I search how to know if an a reference to a xla file is active, in a

xls
file.

Do you have some advice ?

thks a lot




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
Add-In appears to be loaded, but isn't ... Ray Excel Discussion (Misc queries) 6 October 21st 09 07:33 PM
Why do I still get "#NAME?" when I have loaded the Analysis Toolp. Jonathan Excel Worksheet Functions 1 February 2nd 05 05:39 PM
Detecting if a userform is loaded Seth[_5_] Excel Programming 2 November 4th 03 02:59 AM
Determining if a Add-In has been loaded from XLSTART Karl Kawano Excel Programming 0 September 4th 03 02:47 AM
How to hide a loaded .xls...? faustino Dina Excel Programming 1 August 2nd 03 02:52 AM


All times are GMT +1. The time now is 12:54 PM.

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"