1

The case: I use task scheduler that opens excel and a macro is being executed on Workbook_Open. The macro uses a COM Add-in.

The problem: When started from the Task scheduler I get an error that the addin dll is not found and the add-in is missing from the ribbon. Several seconds after accepting the error the add-in appears in the ribbon.

When Excel is started manually, it works fine.

I tried many options but none of them makes the addin to appear in the ribbon before any code is executed.

If someone can help with this I will be grateful.

Private Sub Workbook_Open()
    Set m_syncMgr = CreateSynchronizationMgr
    Application.Run "PLLoginEventHandler"

    On Error GoTo ErrHandler

    Call TaskGFS

This is the code on Workbook_Open, CreateSynchronizationMgr is a function that creates an object from the add-in dll.

The question is how to load the COM add-ins before any code is being executed when Excel is being started from task manager.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
hammer4
  • 11
  • 5
  • The code that loads the COM Add-in should run when Excel starts up. Loading that add-in when the workbook is opened obviously is too late. If you need more help please mkodify your question to include the code that runs on Workbook_Open. – Variatus May 04 '20 at 01:37
  • Thank you for your reply, I have updated my question with the code. – hammer4 May 04 '20 at 01:49
  • When you start Excel using automation, Add-ins are not loaded: you will first need to load the add-in from your code. https://stackoverflow.com/questions/213375/loading-addins-when-excel-is-instantiated-programmatically – Tim Williams May 04 '20 at 02:11

0 Answers0