P
Paul
Dear all,
I am trying to create a DLL in C# and try to invoke the DLL from my
excel VBA code.
This may not be a purely C# problem, since I am not sure
whether I have done something wrong with my excel VBA code too...
I have created the C# component, my code is looking like this:
public class Class1 {
public Class1() {
}
public int TestMethod(int i, int j) {
return i + j;
}
}
and I compiled using Visual studio for C# 2005 (.NET 2.0) with the
"Register for COM interop" option and have the ComVisible(true)
assembly attribute set.
Then I have set the reference to "testdll.tlb" in my Excel VBA
environment.
And my VBA code here
Sub test()
Dim a As testdll.Class1
Set a = New testdll.Class1
End Sub
The problem is.. everytime when I run the macro it complains at the 2nd
line of my VBA code:
"File or assembly name testdll, or one of its dependencies, was not
found."
I spent a day but still unable to figure out which step I was
missing....
If anyone know the answer, please help~~~~
Thank you very much.
Paul
I am trying to create a DLL in C# and try to invoke the DLL from my
excel VBA code.
This may not be a purely C# problem, since I am not sure
whether I have done something wrong with my excel VBA code too...
I have created the C# component, my code is looking like this:
public class Class1 {
public Class1() {
}
public int TestMethod(int i, int j) {
return i + j;
}
}
and I compiled using Visual studio for C# 2005 (.NET 2.0) with the
"Register for COM interop" option and have the ComVisible(true)
assembly attribute set.
Then I have set the reference to "testdll.tlb" in my Excel VBA
environment.
And my VBA code here
Sub test()
Dim a As testdll.Class1
Set a = New testdll.Class1
End Sub
The problem is.. everytime when I run the macro it complains at the 2nd
line of my VBA code:
"File or assembly name testdll, or one of its dependencies, was not
found."
I spent a day but still unable to figure out which step I was
missing....
If anyone know the answer, please help~~~~
Thank you very much.
Paul