Just like the title says, i'm unable to have access to anything pass the "VBProject" object from an active document in c#. When i try to get the list of componenents (modules) from the VBProject object this way :
var components = Globals.addInName.Application.ActiveDocument.VBProject.VBComponents;
I get the following error at compile time in c# :
error CS1061: 'object' does not contain a definition for 'VBComponents'
However, what's funny is that if i remove "VBComponents" and use the debugger to explore the variable, i can see a VBComponents, as well as the number of modules available in the document. I really don't understand how visual studio is unable to find it. I tried including Microsoft.Vbe.Interop; without much success. While i'm now able to have a VBComponents type, i am still unable to compile.
I have the following usings in my project at the moment :
using Visio = Microsoft.Office.Interop.Visio;
using Office = Microsoft.Office.Core;
using VBE = Microsoft.Vbe.Interop;
I've honestly searched for many hours, included various references in my project, but without any success. I simply cannot compile my addin. Yet i'm able to do it very easily in vba with almost the same syntax.
Is there anything i am missing?