I am looking to be able to execute code from a Java project inside an Excel VBA sheet. Elsewhere on SO, I have discovered IKVM, which is a .NET implementation of Java which allows converting a .jar into a .dll. I was hoping this would let me access the classes/methods from the .jar inside the VBA editor, but I am having trouble doing so.
I have tried using the declare statement in VBA (in many different permutations, attempting to make it work) but the most common error refers to entry points in the .DLL.
I have also tried registering the .DLL as a reference in Excel, but it gives a boilerplate error and does not register it.
As a reference, I've been testing it using the following class before bothering to test it with the whole project:
public class IKVMTest {
public static void print(String s) {
System.out.println(s);
}
}
This class is compiled by Eclipse and exported into IKVMTest.jar. At this point, I use ikvmc -target:library IKVMTest.jar
to receive IKVMTest.dll. For simplicity's sake, this .dll and the Excel sheet I am testing in are dumped in the IKVM bin folder (since there are some dependencies on the IKVM .dll files).
If I could get it working for this sample test, I could get it working for the project overall.