I am writing a C# DLL which must be COM visible as it's main use case will be embedded into Microsoft Excel VBA (I know). Whilst developing I have been using Visual Studio's "Register for COM Interop" checkbox and having the process done for me. This has been working fine on my PC as I am able to get valid outputs in Excel, however now I am trying to register the DLL on client machines (manually) and I seem to be having issues with making valid calls as Excel only returns !VALUE.
This following has been my process:
AssemblyInfo.cs:
[assembly: ComVisible(true)]
Class1.cs:
namespace ManualRegister
{
public class Class1
{
public string test()
{
return "Working!";
}
}
}
Copy ManualRegister.dll
into SysWOW64
Register.bat:
cd/
C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe ManualRegister.dll /tlb:ManualRegister.tlb /codebase
pause
Adding reference to VBA module.
VBA Code:
Function test()
Dim object As New ManualRegister.Class1
test = object.test()
End Function
VBA error:
Can anyone see what step I'm missing / doing wrong?
(I have also tried specific CPU architecture builds to no avail)