I’m developing a vb6 application that uses Microsoft office word.
each single word11,word12,word14 object libraries can make my application work. But How do I detect which version of Office is installed and thus which version of the “Microsoft Word Object Library” is available, and subsequently load it?
Note: I don’t want to use .net because many of my clients do not want to install .netframework.
Generally:
Code to the lowest version of Word you plan to support or do version tests before invoking any methods/properties that might not be supported under all versions
You don’t load a Word Object Library; you invoke an instance of Word and automate it. Windows figures out which version of Word to invoke if there are multiple versions; once you have a Word object, you can query its version for your version tests.
On my PPT FAQ site, there’s some general information about this; the same code should work in VB6 with only minor alterations, if any.
Controlling Office Applications from PowerPoint (by Naresh Nichani and Brian Reilly)
http://www.pptfaq.com/FAQ00795_Controlling_Office_Applications_from_PowerPoint_-by_Naresh_Nichani_and_Brian_Reilly-.htm