Skip to content

Releases: Greedquest/vbInvoke

v1.2.0

13 Feb 23:12
Compare
Choose a tag to compare

What's Changed

🎯 Use MIT by @Greedquest in #5
🎯 Switch to tbShellLib by @Greedquest in #10

  • Improved support for returned Type Information with complete ITypeLib interface
  • Purge a load of dead code
  • Fix logging of the linked list pointers (see #7 )
  • Add Readme
  • Treat .twin files as VBA (#8)

Full Changelog: v1.1.0...v1.2.0

v1.1.0

31 Jan 00:05
Compare
Choose a tag to compare

Full Changelog: v1.0.1...v1.1.0

Fix code to work in 32-bit and 64-bit saved & unsaved

v1.0.1

30 Jan 16:11
Compare
Choose a tag to compare
v1.0.1 Pre-release
Pre-release

Full Changelog: v1.0.0...v1.0.1

Fixed faulty ITypeLib definition so that this works on 32-bit

Note:

  • 64-bit xlsm must be saved and re-opened
  • 32-bit xlsm must be saved and have mature content

Otherwise this technique doesn't seem to pick up the parent typelib name and will raise an error

v1.0.0

30 Jan 13:22
Compare
Choose a tag to compare
v1.0.0 Pre-release
Pre-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.