David Peterson
David Peterson

Reputation: 552

Using ONE of microsoft word11 word12,word14 object library inside VB6

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.

Upvotes: 0

Views: 752

Answers (2)

Deanna
Deanna

Reputation: 24313

Either use late binding (... As Object) or build against the earliest version you want to support. The object libraries are backwards compataible and COM handles the versioning so you will always get the latest version installed.

Upvotes: 2

Steve Rindsberg
Steve Rindsberg

Reputation: 3528

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

Upvotes: 2

Related Questions