Skip to content

v1.0.0

Pre-release
Pre-release

Choose a tag to compare

@Greedquest Greedquest released this 30 Jan 13:22
· 26 commits to main since this release

First public release. Has 2 main methods and 2 ways of calling them:

ActiveX DLL (Tools⇒Add Reference)

Function GetStandardModuleAccessor(ByVal moduleName As String, ByVal proj As VBProject) As Object
Function GetExtendedModuleAccessor(ByVal moduleName As String, ByVal proj As VBProject, Optional ByRef outPrivateTI As [_ITypeInfo]) As Object

Standard DLL Declare

Declare PtrSafe Function GetStandardModuleAccessor Lib "vbInvoke_win64" (ByVal moduleName As Variant, ByVal proj As VBProject) As Object
Declare PtrSafe Function GetExtendedModuleAccessor Lib "vbInvoke_win64" (ByVal moduleName As Variant, ByVal proj As VBProject, ByRef outPrivateTI As IUnknown) As Object

Note: The standard DLL version uses Variant for the module name and has no optional arguments


These 2 functions create "Accessors": IDispatch Objects that can be used with dot notation accessor.Foo or call by name CallByName(accessor, "Foo", ...) to invoke

  • Public methods/functions/properties of modules (Standard Accessor)
  • Public or Private methods/functions/properties (Extended Accessor)

You can also use the Extended Accessor in a For-Each loop to print all the public & private methods (although this API may change to be more useful):

Dim exampleModuleAccessor As Object
Set exampleModuleAccessor = GetExtendedModuleAccessor("ExampleModule", ThisWorkbook.VBProject)

For Each methodName In exampleModuleAccessor
	CallByName exampleModuleAccessor, methodName, vbMethod
Next methodName

Finally you can reference this library as a .twinpack. This library only works when compiled into in-process DLLs or VBE Addins - it cannot be used to create a standalone EXE as it relies on sharing memory with the active VBProject.