Question

What happened to OCX's? Are they no longer possible to create with the latest tools?

I need to create an ActiveX control that I can place in Word, PowerPoint and Excel documents. If I use VS.NET, I can only create a UserControl DLL with COM Interop, but I don't think I can add that using the "More Controls" toolbox of PowerPoint's Developer Tab.

What would you do?

Was it helpful?

Solution

Yes, you can still create them. But you can't create an OCX with a .NET language. Need to be unmanaged C++ (or VB). The DLLs with COM interop you can create in C# or VB.NET are just .NET objects that are invoked via CCW.

OTHER TIPS

You can still use .NET to create ActiveX components. However, this is experimental and not recommended. If you still want to try it you can find information in the blog of Andrew Whitechapel:

Using Managed Controls as ActiveX Controls

But as Andrew says:

This seems to work OK for Excel (with the very limited testing I've done), partly works with PowerPoint, but fails miserably with Word.

So if you don't want to spend a lot of time debugging strange errors I would recommend you to use the old VB 6.0 and Visual Studio 6.0 to build you ActiveX components.

Use a C++ or VB compiler which can target native code + ActiveX.

Depending on what you need to do, an Add-in may be more appropriate than an OCX, and you can certainly create those with .NET. You should also look at the Visual Studio Tools for Office, not as a direct replacement for an OCX, but only to understand the new capabilities. It may show you new approaches to the problems you're now solving with an OCX.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top