1) Any method you want to expose to COM must not be static (except the registration functions). So Tax() as defined above will not work. Take the static out.
2) Myself and many others get the error "mscoree.dll is not found" when adding the automation control to Excel. Many writers tell you to ignore the error. Ignoring it will not make it go away. You must append the following to your RegisterFunction()
Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(
"CLSID\\{" + t.GUID.ToString().ToUpper() +
"}\\InprocServer32");
key.SetValue("", @"C:\Windows\System32\mscoree.dll");
And if you're running Excel 2002 you will have to add a file called Excel.exe.config to your c:\program files\microsoft office\office11 and put this in it:
<?xml version="1.0" ?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>