And to expand on registering the DLL on different computers.
Once you compile and build the above code on your development machine, if you have
The project properties Build tab, select Register for COM interop.
your Visual Studio output folder (usually bin\Debug) where the compiled *.dll is found will also have a *.tlb file.
This *.tlb file is a 'Type Library'. And is needed by the client machine to understand the different 'Types' in your *.dll and to basically tell the client machine how to use it.
By setting the above 'Register for COM interop' -- aswell as a *.tlb file being produced, the assembly(dll) is registered on your machine, and is therefore accessible.
In VBA you can now add this file as a reference by
VBA Editor -> Tools -> References -> Browse -> Select
this will allow you to then declare the classes found in your library.
Dim TestClass As Test
Set TestClass = New Test
MsgBox TestClass.HelloWorld
HOWEVER - if you want to then use your dll on a different client machine, you will have to use regasm.exe - to register the assembly(dll) on that machine.
This can be done by the command line,
regasm.exe
in this case
regasm.exe TestDll.dll
once you have registered the assembly on the new client machine, you will be able to access it by again adding a reference to its *.tlb
Hope this helps!