
Running .NET from VBA
Just experimenting with different ways to load CLR (.NET) assemblies on VBA locally and remotely by using AppDomain.ExecuteAssembly or any other handy method after getting arround AccessVBOM (programmatic access to visual basic project is not trusted) from VBA.
vba2clr.*.vba:
AccessVBOM regkey to 1Word.Application COM object. (could be Excel.Application MS PowerPoint, Access ..etc).wordObj.Application.Run...ExecuteAssembly.clr.2.0.vba: Up to .NET 3.5
IDomain, ICRHost)AppDomain.ExecuteAssembly arguments into two separate arrays (variables, types).AppDomain.ExecuteAssembly(Arg1, Arg2) (VFTable offset 51) where Arg1 is the ".NET Assembly URL" or "Local Path" and Arg2 is the return value.QueryInterface, AddRef, Release methods.ExecuteAssembly.clr.x.vba: supports .NET 2, 3.5 and 4.x
Word.Application (or Excel.Application ..etc), will result spawning an additional WinWord.exe as a child process of svchost.exe instead of the main WinWord.exe process.AccessVBOM Registry key is modified/restored via COM using WScript.Shell , using win32 APIs could be a better alternative.AccessVBOM registry key, will leave this for an other day...System.CodeDom.Compiler can be used to compile/execute c# code from VBA, check reference below;