Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Coders,

I want to add a check for Microsoft Office 2003 or 2007 in my code.

If I want to import the Excel 2007 dll's and not 2003's how can I check using a macro if 2007 is installed or not?

If it is then 2007 dll's should be included and if not then 2003 dll's should be included.


For Example:
//if 2007 
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\MSO.DLL"
// else if 2000
#import "C:\Program Files\Microsoft Office\Office\MSO9.DLL"


please help .

Thanks in advance
Posted
Updated 18-Aug-10 23:23pm
v3
Comments
Dalek Dave 19-Aug-10 3:27am    
Minor Edit for Readability.
Emilio Garavaglia 19-Aug-10 5:23am    
retagged as C++/CLI

1 solution

With a quick search in CodeProject I found this[^] useful article. :)
 
Share this answer
 
Comments
Dalek Dave 19-Aug-10 4:06am    
Good Call.
Eugen Podsypalnikov 19-Aug-10 4:45am    
...any idea to switch the #import directive ? :)
Nuri Ismail 19-Aug-10 5:24am    
Shortly I have no idea.
Since #import directive creates header files I don't think that this directive can be used dynamically (but I'm not sure, it's only an opinion).
I decided to answer the question about getting the office version.
I'm not familiar with power and flexibility characteristics of #import, because I've only used C/C++ automation (CoCreateInstance(), IDispatch, IUnknown etc) in the past. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900