ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   When do AddIns load? (https://www.excelbanter.com/excel-programming/417335-when-do-addins-load.html)

Maury Markowitz[_2_]

When do AddIns load?
 
Due to the way that Excel locks XLA's when loaded from the network,
we're trying to lazy-load them when needed. We have a single very
small XLA that's put into the AddIns, with a single exposed sub that
you can call to load other XLAs on demand.

This seems to work well when you do everything inside Excel, but I
notice it doesn't work if you call Excel from another program, in this
case Access. When you open Excel using CreateObject, there's no AddIns
at all. Is there something I need to do to trigger Excel to load them
up?

Here's the code, it fails on the application.run...

On Error Resume Next
bStarted = False
Set oExcelApp = GetObject(, "Excel.Application")
If Err < 0 Then
' excel wasn't running, start it from code
Set oExcelApp = CreateObject("Excel.Application")
bStarted = True
End If
On Error GoTo 0
oExcelApp.Visible = True

' make sure that HPLCreate is open and up to date
ret = oExcelApp.Application.Run("ModuleLoader.xla!
LoadAndUpdateAllModulesInXLA", "HPLCreate")


Dave Peterson

When do AddIns load?
 
You can open them yourself.

oExcelApp.workbooks.open("C:\yourpath\ModuleLoader .xla")

(That's the way automation works.)


Maury Markowitz wrote:

Due to the way that Excel locks XLA's when loaded from the network,
we're trying to lazy-load them when needed. We have a single very
small XLA that's put into the AddIns, with a single exposed sub that
you can call to load other XLAs on demand.

This seems to work well when you do everything inside Excel, but I
notice it doesn't work if you call Excel from another program, in this
case Access. When you open Excel using CreateObject, there's no AddIns
at all. Is there something I need to do to trigger Excel to load them
up?

Here's the code, it fails on the application.run...

On Error Resume Next
bStarted = False
Set oExcelApp = GetObject(, "Excel.Application")
If Err < 0 Then
' excel wasn't running, start it from code
Set oExcelApp = CreateObject("Excel.Application")
bStarted = True
End If
On Error GoTo 0
oExcelApp.Visible = True

' make sure that HPLCreate is open and up to date
ret = oExcelApp.Application.Run("ModuleLoader.xla!
LoadAndUpdateAllModulesInXLA", "HPLCreate")


--

Dave Peterson


All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com