Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Addins disabled

Status
Not open for further replies.

DianeA

Programmer
Nov 15, 2007
56
0
0
CA
I'm launching excel spreadsheets from a main menu in Access. These spreadsheets are key to data that gets entered into the database. I thought this would be easier for the user but I've discovered that some 3rd party addins don't get installed using this method.

After excel has launched i am able to manually add them in but this would be painful everyday. How do I ensure addins load correctly?

Thanks
Diane
____________________________
Dim oApp As Object

Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
oApp.Application.Workbooks.Open ("G:\HOEP.xls")
On Error Resume Next
oApp.UserControl = True
 
There may be the problem with rights or working with multiple excel instances. When you install excel add-in, 'installed' state is updated in the registry when you close excel. The current registry setting is used for new instance.
The code to install add-in (existing in the list):
oApp.AddIns("Test").Installed = True


combo
 
How do you determine the name to use for the addin? Would this be like the executable name? I'm assuming i substitute my addin name for "Test".

 
I was not initially able to get your stmt to work. I checked the Addin module to see what it was showing me and all applicable addins were checked already but not loaded. To resolve this I added the following:

oApp.Application.AddIns("PI-DataLink").Installed = False
oApp.Application.AddIns("PI-DataLink").Installed = True

Seems like a bear to do this for every addin prior to using excel. The other thought was if one user has different addins then the next... I would need to know which addins every user would need to work with. Is there an easier way of just auto-loading a particular users addins without me having prior knowledge?
 
Do you use 'xla' addin? Its name is the same as in addins dialog. To make this code work, it has to be available in the addins list.

combo
 
Yes... i am using xla but for some reason I need to Uncheck (with false) and then Check (True) in order for this to work. Any thoughts?

Diane
 
I did a test of custom addin with automation and it worked (excel xp). However MS reports that the addin may not be loaded in some cases. In this case it is necessary to open the proper file. You could try (NB, in your case oApp is an instance of evxel.application, there is no need to call its Application property again):
Code:
For Each xlAddIn In oApp.AddIns
    If xlAddIn.Installed = True Then
        On Error Resume Next
        txtTest = oApp.Workbooks(xlAddIn.Name).Name
        lastError = Err
        If lastError <> 0 Then
            oappWorkbooks.Open (xlAddIn.FullName)
        End If
        On Error GoTo 0
    End If
Next xlAddIn


combo
 
Do not create a new instance if one already exists. This will cause the add-ins to not be loaded again, as well as not opening Personal.xls. Instead, check for existence. Here is a thread which shows a couple of good methods for controlling Excel from Access, although it can be adapted to work with most applications...


HTH

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top