Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Add-In appears to be loaded, but isn't ... | Excel Discussion (Misc queries) | |||
Why do I still get "#NAME?" when I have loaded the Analysis Toolp. | Excel Worksheet Functions | |||
Detecting if a userform is loaded | Excel Programming | |||
Determining if a Add-In has been loaded from XLSTART | Excel Programming | |||
How to hide a loaded .xls...? | Excel Programming |