32 bit dll in Office 64 bit

2019-03-28 06:31发布

问题:

I understand that I cannot load a 32 bit dll in a 64 bit process. I have a 32 bit dll (VB6 component), with no source code, that is loaded in an Excel automation macro. What are my options?

回答1:

32-bit add-ins are not supported on 64-bit. Microsoft recommends to use the 32-bit version of Office unless you run into the memory limitations of a 32-bit process which is only likely to happen if you need to deal with extremely large spreadsheets:

The recommendations for which edition of Office 2010 to install are as follows:

  • If users in your organization depend on existing extensions to Office, such as ActiveX controls, third-party add-ins, in-house solutions built on previous versions of Office, or 32-bit versions of programs that interface directly with Office, we recommend that you install 32-bit Office 2010 (the default installation) on computers that are running both 32-bit and 64-bit supported Windows operating systems.

  • If some users in your organization are Excel expert users who work with Excel spreadsheets that are larger than 2 gigabytes (GB), they can install the 64-bit edition of Office 2010. In addition, if you have in-house solution developers, we recommend that those developers have access to the 64-bit edition of Office 2010 so that they can test and update your in-house solutions on the 64-bit edition of Office 2010.

If you need to go with the 64-bit version because of the memory limitations you have the following options:

  • If you have the source code, you can generate a 64-bit version yourself,

  • You can contact the vendor for an updated version,

  • You can search for an alternative solution.

There actually is a fourth option which is not mentioned in this article by Microsoft: You can create a 32-bit out-of-process COM server which serves as a proxy between your 64-bit macros and the legacy 32-bit COM components or create a COM+ application. A sample is provided here:

Accessing 32-bit DLLs from 64-bit code