Fighting to get a COM visible VSTO Addin so its method can be used by VBA

Fighting to get a COM visible VSTO Addin so its method can be used by VBA

So I am having some troubles and am learning too much about old technology. In short – my interface is COM visible to my VBA in my Excel code, but not the class. Crap – add the word public in front of class – fixed it. None-the-less here is a blog of what helped me solve my issue. I WANT (insist) early binding (aka intellisense 🙂 ) (Something close to my issue). Want to know even more … look at the links at the bottom of this article.

First – set up things properly.

  • Have a GUID for the interface IMyInterface and on the class MyClassO
  • Have the dual interface turned on on the interface and class

  • have a class MyClassO that inherits these Interface StandardOleMarshalObject, IMyInterface
  • in the ThisAddin.cs … have the following method
    • private MyClassO utilities;
      /// <summary>;
      ///
      /// </summary>
      /// <returns></returns>
      protected override object RequestComAddInAutomationService()
      {
      if (utilities == null)
      {
      utilities = new MyClassO();
      }return utilities;
      }
      
  • Did you check the Object Broswer in VBA???
    • Go to VBA Editor and press F2 or choose View-Object Browser
    • Change the “All Libraries” pull down to the name of you namespace or library
    • I saw my library – but just the interface.
  • Does the OLE / Com Object viewer show the same? It should
  • It did! so look at this article How COM works – this guy is WAY TO FAMILIAR – but is the reason I solved my issue – thanks man!

More articles that I wished I put here in my blog but was in my c# code so I copied it here – hope this helps

ELB Solutions.com Inc.
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.