Excel – VBA Compatibility between different Office Versions

excelvba

Sorry if this is a silly question.

What can I do to make my VBA code work on Office 2003/2007/2010 ?

Can it be done or should I create different VBA code for each?

I use

  1. WinHttp.WinHttpRequest.5.1
  2. Make a lot of Windows API Calls
  3. Have five references to libraries
  4. wininet.dll
  5. kernel32
  6. Outlook.Application
  7. InternetExplorer.Application

I'm developing on Office 2007 but users with Office 2010 cant run the code. Not sure about users runnning other office versions.

I have also seen that one can create an Excel-Addin in Visual Studio but I dont have a lot of experience in that area.

Thx for any suggestions.

Best Answer

for different versions of Excel, you can just use Conditional Compilation such as #If Application.version>n then

However, for any users who have Win64 systems, you will have to provide different methods of calling the API functions.

Your best bet is to try and manipulate Excel using Automation either from .NET using Office.Interop, or VSTO.