How to make the transition to C ++ between different versions of MS Office?

I have an old MFC tool for converting xls files to txt. It is designed for some specific data structure and it is not easy to rewrite it with a new structure (e.g. Qt).

The application works with excel and there is a file "Office.h" where the macro of office versions is defined:

// Office.h

//#define Uses_MSO97
//#define Uses_MSO2000
//#define Uses_MSO2002
//#define Uses_MSO2003
//#define Uses_MSO2007
#define Uses_MSO2010

Question: how to make the application determine which version of MSO is present on the computer and use it?

I would say I have access to the source code. The macro is used as:

#ifdef Uses_MSO2007
#import "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\mso.dll" \
    rename("DocumentProperties", "DocumentPropertiesXL") \
    rename("RGB", "RBGXL")
#import "c:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6\vbe6ext.olb"
#import "C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE" \
    rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") \
    rename("DocumentProperties", "DocumentPropertiesXL") \
    rename("ReplaceText", "ReplaceTextXL") \
    rename("CopyFile", "CopyFileXL") no_dual_interfaces
#endif
+3
source share
1 answer

The first thing you need to do is extract your code into a .dll.

You can then configure the solution to compile the dll version for each Uses_MSOXXXX macro.

, dll, . ( LoadLibrary)

0

All Articles