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
LongPtr
toLong
and remove allPtrSafe
specifiers.
- (not tested) To use on Visual Basic 6.0, rewrite
- .NET 6.0 or higher
- The file
vb2net.runtimeconfig.json
specifies .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.zip
from Releases and extract it (vb2net.dll
andvb2net.runtimeconfig.json
will be extracted) - Write your code with calling
InitializeVb2net
procedure
- After initialization,
LoadAssembly
andLoadAssemblyFromFile
can be used. - The sample is in vb2net.bas as
Sample
procedure.
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.