Word 10 / Word 11

  • Thread starter Thread starter Urs Vogel
  • Start date Start date
U

Urs Vogel

Hi

I'm aware that this is the wrong newsgroup, but someone may give me a hint
where to find an answer to this problem.

My .Net app is using the Word (Office 2003) object, but some of my customers
are still using Office XP or even earlier versions. I can determine the
installed version, but some of the interop calls differ and cannot handle
certain parameters, such as XMLTransfrom in the Document.Open method. Is
there a way to generate an assembly which supports different versions of
Word (or Office in general), or do I have to create a version of my app for
every Office version (2K, XP, 2003)? This would be really silly.

Thanks for any hints.

Urs
 
* "Urs Vogel said:
I'm aware that this is the wrong newsgroup, but someone may give me a hint
where to find an answer to this problem.

My .Net app is using the Word (Office 2003) object, but some of my customers
are still using Office XP or even earlier versions. I can determine the
installed version, but some of the interop calls differ and cannot handle
certain parameters, such as XMLTransfrom in the Document.Open method. Is
there a way to generate an assembly which supports different versions of
Word (or Office in general), or do I have to create a version of my app for
every Office version (2K, XP, 2003)? This would be really silly.

You can use late binding instead of early binding to write version
independent access to word. Have a look at 'CreateObject' and
'GetObject'.
 
It is better to use early binding and do the coding with VB 6, compiling
using the earliest version of Office you wish to support.
 
Herfried

Thanks, I'll follow this approach. This doesn't work with events, though, if
the object is declared as object and no reference is made to the COM object.
Any suggestions how to intercept COM events? Sample:

Dim objWord As Object = GetObject(, "Word.Application") '---
Word.ApplicationClass ---
AddHandler objWord.ApplicationEvents_Event_Quit, AddressOf
Me._ApplicationEvents_Event_Quit
AddHandler objWord.DocumentBeforeClose, AddressOf Me._DocumentBeforeClose

How do I dynamically access the events in a COM object? Amy hints?

Thanks.
Urs
 
Back
Top