I have an application that uses VBA to interface with libraries written in .NET. The assemblies for these libraries is then registered as COM components. I am trying to get rid of the COM registration part. Essentially, I want the application to be able to function as long as the assembly is present, regardless of whether or not the assembly has been registered.
From what I can gather, it seems to be possible. I found some promising looking code samples
here and
here. From these, I have tried the following:
Application.VBE.ActiveVBProject.References.AddFromFile "C:\SomeDirectory\SomeAssembly.dll"
and
Dim VBAEditor As VBIDE.VBE
Dim VBProj As VBIDE.VBProject
Set VBAEditor = Application.VBE
Set VBProj = VBAEditor.ActiveVBProject
VBProj.References.AddFromFile "C:\SomeDirectory\SomeAssembly.dll"
Neither works. The first one tells me "Expecting a var name", while the second one complains that "Type identifier is invalid".
So, anyone know what I'm doing wrong?
Also, I'm VERY new to VBA; so, if possible, please keep the explanations simple.