I’m building a c/c++ program and I’m using MS Excel for results representation. The problem is that i have to import 2 files:
#import "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE14\MSO.DLL"
#import "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE"
It works perfectly on my computer but path to those files is dependent on Windows version(x64/x86) and Office version (11,12,14).
So my idea is to ask customer for those versions (in main), and then depending on input use different imports. But I dont know how to do that… Something like this doesnt work:
scanf("%d",ver_office);
if (ver_office==1){
#import "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12\MSO.DLL"
}
Import is performed by preprocessor, so you can’t do it in runtime, i.e. you have to know all paths before compilation is started