I am trying to create a COM dll. I have compiled the code and registered it with regasm. I have also added the tlb as a reference in a VBA project. However, my VBA project cannot see the methods. Both sets of code are below.
COM Library - Compiled to DLL, registered with regasm as tlb, added tlb to VBA project references
using System;
using System.Net;
using System.Runtime.InteropServices;
using System.Globalization;
namespace ClassLibrary1
{
[Guid("a81acfd7-ca29-4b71-b45d-d9ffd8930036")]
public interface ITest
{
string HelloWorld(string name);
}
[Guid("bb212288-fa1a-432a-9456-e1c3bb78923f"), ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public class Test : ITest
{
public string HelloWorld(string name)
{
return "Hello World! I'm " + name;
}
}
}
VBA Project - Simple test. Reference to tlb added. Compile error: Method or Data Member not Found on Call Thing.HelloWorld("Fred")
Sub bob()
Dim thing As ClassLibrary1.Test
Call thing.HelloWorld("Fred")
End Sub