4

Currently I am trying to write some application inside an ActiveX control to use it in Excel, Word and Powerpoint. This should be done in C# and I would be totally happy with a single Label with Hello World text.

Using visual Studio 2013, I created an MFC ActiveX control (which draws an elipse). This works in Word, Excel and Powerpoint, but is C++ instead of C#.

So, here is what I tried:

  • Created a new solution with a C# Library project.
  • I set the "register for COM interop" flag in the settings
  • I ran VS with admin rights to allow studio to register and unregister
  • I wrote a class the derives from UserControl and creates a label (User control tested in application)
  • I added
[ProgId("ActiveXHelloWorld.HelloWorld")]
[ClassInterface(ClassInterfaceType.AutoDual)]
[Guid("some self created GUID")]
[ComVisible(true)]

and ensured that class name and namespace match the ProgID

  • I signed the assembly with a self generated key
  • I build the solution and checked, that the command is registered (regedit)
  • The control is available in word, but when I tried to place it, I get

The program used to create this object is {some self created GUID}. That program is either not installed on your computer or it is not responding. To edit this object, install {some self created GUID}or ensure that any dialog boxes in {some self created GUID}are closed.

Does anyone have a working minimal example or can explain to me what I am missing?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
curator
  • 175
  • 2
  • 10

0 Answers0