Search code examples
excelvbavb6

Can 64-bit Excel VBA use VB6 ActiveX?


I have some old ActiveX controls and DLLs written in VB6 that interact with some Excel VBA code. We have always recommended that people use the 32-bit version of Excel, but I thought I'd have another go at getting this to work in 64-bit.

Is this possible?

The objects are created in the VBA code using CreateObject (late binding), but this fails when using the compiled ocx/dll. If I run the code in the VB6 IDE though, it can create the object with no problem.

Any suggestions appreciated.


Solution

  • This actually turned out to be very simple, although I wasted a lot of time looking into other options.

    All that is required is to change the project type from ActiveX DLL or ActiveX ocx to ActiveX exe. No code changes needed on either Excel or VB side.

    A bit of a tweak was required for deployment. The system we use for making the installer has an option to register dlls and ocxs but this doesn't work for the exe, but all I needed to do was tell it to run the exe with /regserver parameter at the end of the install.