The helper module vb2net for Visual Basic for Applications (VBA) 7.0 and support DLL, providing access to .NET (formerly .NET Core) assemblies and classes.
- Visual Basic for Application 7.0 (included in Microsoft Office 2010 or higher)
- (not tested) To use on Visual Basic 6.0, rewrite
LongPtrtoLongand remove allPtrSafespecifiers.
- (not tested) To use on Visual Basic 6.0, rewrite
- .NET 6.0 or higher
- The file
vb2net.runtimeconfig.jsonspecifies .NET version 6, so if you use version 7 (or higher), please modifyvb2net.runtimeconfig.json.
- The file
- Import vb2net.bas and ExitHandler.bas into your VB/VBA project
- Download
vb2net.zipfrom Releases and extract it (vb2net.dllandvb2net.runtimeconfig.jsonwill be extracted) - Write your code with calling
InitializeVb2netprocedure
- After initialization,
LoadAssemblyandLoadAssemblyFromFilecan be used. - The sample is in vb2net.bas as
Sampleprocedure.
Visual Studio 2022 is required to open the solution file vb2net/vb2net.sln.
Build vb2net/vb2net.csproj by dotnet build vb2net.csproj -p Release, or with Visual Studio or related build tools.