I have cross posted on access-programmers.co.uk
Please post responses on that forum is possible..
I have compiled a dll in c# 3.5.. where I set the solution properties to register the build for COM interop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace SBG_TestWithVBA
{
[ClassInterface(ClassInterfaceType.AutoDual)]
public class TestHello
{
[ComVisible(true)]
public string SayHello(string name)
{
string message = "Hello " + name;
return message;
}
public string HelloWorld()
{
string message = "Hello World!";
return message;
}
}
}
I have then registered the assembly and tlb file using
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe" "\sbgfs01\users\Vincent Pirolli\My Docs\Visual Studio 2008\Projects\TestWithVBA\TestWithVBA\bin\Release\SBG_TestWithVBA.dll" /tlb: "\sbgfs01\users\Vincent Pirolli\My Docs\Visual Studio 2008\Projects\TestWithVBA\TestWithVBA\bin\Release\SBG_TestWithVBA.tlb"
I then add the tlb file within vba from the tools>references menu..
and my VBA code is as follows:
Sub test()
Dim f As SBG_TestWithVBA
Set f = New SBG_TestWithVBA
f.HelloWorld
End Sub
I get the following error even though Intellisense works within the VBA editor: "Automation error The system cannot find the file specified."
Anyone got any ideas? I have the articles in the previous posts but I cannot find the solution.