0

I have a library written in C# that uses standard .NET framework libraries (System, System.Windows.Forms). This library is COMVisible as well as its classes, I just have two classes: - TestClass (a class with one method) - TestForm (an empty form)

I registered the assembly as suggested here: C# COM DLL: do I use Regasm, or Regsvr32?

Then I went to my Excel Add-In and added a reference to the generated .TLB file.

I am able to create an instance of my "TestClass" and invoke its method without any problem, but when I try to create an instance of my "TestForm" it shows me this error:

Run-time error '-2147024894 (80070002)':

Automation error
The system cannot find the file specified.

According to the issues I saw when trying to get the class working, the problem is that one of the dependencies (I'm guessing System.Windows.Forms) is not being found by Excel.

How do I open a Form written in .NET from my 64bit Office add-in?

Thanks in advance

Community
  • 1
  • 1
willvv
  • 8,439
  • 16
  • 66
  • 101
  • Pretty standard DLL Hell problem. Fuslogvw.exe tells you about managed assembly resolution problems. SysInternals' ProcMon gives you *everything*. Some digging required. – Hans Passant Nov 30 '11 at 23:29

1 Answers1

1

Below example may helps u how VBA7 code works in 64bit Office.

Adding into the 64Bit Office Addins may not be a problem, but when you try to use them in the VBA7,u will definetly experiance a problem.

Testing if weither using the 64-bit version(VBA7) of Office 2010:

#If Win64(VBA7) Then
   Declare PtrSafe Function GetTickCount64 Lib "kernel32" () As LongLong
#Else(VBA)
   Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long
#End If

If i am wrong reach me with the solution @kirantej@gmail.com Hence, i am working on the same task too...:-P

nmc
  • 8,724
  • 5
  • 36
  • 68
kirantej
  • 11
  • 1