LoginSignup
1
2

More than 3 years have passed since last update.

C#で作ったCOMをExcel VBAから呼ぶ

Posted at

事象

dllをregasmで登録。その後VBAエディタで参照設定すると、インテリセンスは効くがオブジェクト生成できない
→実行時エラー「ActiveXコンポーネントはオブジェクトを作成できません。」

原因

32bitのregasmで登録していたから。
もしExcelが32bitなら、64bit版のregasm使わなくてもいけたのかもしれない。

[NG]
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\regasm CCC.dll /codebase /tlb

[OK]
%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\regasm CCC.dll /codebase /tlb

[おまけ、登録解除]
%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\regasm /tlb /u CCC.dll

発生環境

windows10 1803 64bit
VS2019 16.0.3
Excel 16.0.11727 64bit

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2