Results 1 to 1 of 1

Troubles while trying to call an AddIn from an Excel launched by automation

Threaded View

  1. #1
    Registered User
    Join Date
    09-11-2008
    Location
    paris, france
    Posts
    4

    Troubles while trying to call an AddIn from an Excel launched by automation

    Hi everyone,

    I've created an automation AddIn for Excel. It is not a COMAddIn (I don't implements IDTExtensibility2). It is not an XLA or a XLL neither.

    It is just a COM component which is loaded in the AddIn dialog box of Excel via its COM id. You can find it in the registry under the key HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Options, with an OPEN entry set to value /A "WdLayer.XLLMAP.1".

    If you need more information on Automation addin, please have a look at: http://support.microsoft.com/kb/291392

    But when I call a method called "IsAddinStartupComplete" from XLLMAP, my COM component, I encounter a synchronization issue depending on the list of other addins loaded on excel startup. If no other addin are loaded, my call succeeds, otherwise when I launch the call it might fails. If I put a break point in the VBA code below, and wait a little bit, it succeeds. So basically, I need to know when I can be sure that my addin will be usable because I get the Excel application COM instance way before everything is loaded and I'm not able to know when it will be ok to use need. I'm simply unable to synchronize myself with my Excel automation instance. Would someone have an idea of how to do it ?
    Sub Test()
      Dim excel As excel.Application
      Set excel = CreateObject("excel.Application")
      
      excel.Visible = True
      
      Dim ourAddin As excel.AddIn
      On Error Resume Next
      Set ourAddin = excel.AddIns("XLLMAP Class")
      Debug.Print IIf(ourAddin.Installed, "Installed", "NotInstalled")
      
      bool = excel.Run("IsAddinStartupComplete")
      
      Debug.Print IIf(bool, "Success", "Failure")
      
      excel.Quit
    End Sub
    Last edited by romperstomper; 07-11-2011 at 12:03 PM. Reason: code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1