Excel .NET COM - Automation error. The system cannot find the file specified

前端 未结 5 823
名媛妹妹
名媛妹妹 2021-02-12 11:43

I have a .NET 2.0 COM object that\'s used by VBA in Excel. It works fine on my dev machine, but when trying to use it on a clean VM workstation I get this error:

Automat

5条回答
  •  暖寄归人
    2021-02-12 12:28

    On windows 7, 64 bit and a .NET 4.0 framework dll (32 bit) that I want to be usable as a COM object for a Microsoft Excel 2010 VBA application, here is what worked for me.

    1. Copy the dll to c:\windows\syswow64
    2. In a cmd shell, run

      C:\Windows\Microsoft.NET\Framework\v4.0.\regasm.exe c:\windows\syswow64\ /codebase /tlb:c:\windows\syswow64\.tlb
      

    You can skip the last part (/tlb:. . .) if you don't want or need intellisense on the machine you are registering the assembly on.

    The key hangup I had is that on XP I never had to use the /codebase parameter before but that was the key thing needed before this worked.

提交回复
热议问题