Running .NET addin built on XP 2003 machine on a XP 2002 machine....

P

Philip

I have a .NET addin that was written on a machine that has Office XP 2003 installed on it which uses the Microsoft Word 11.0 Object library to open Word and add some custom attributes to an existing Word file. I am now trying to run that application on a machine that has Office 2002 installed on it. Should this work? My application seems to fail when trying to use a reference to the Word Object. This works fine with Office 2003, but not in Office 2002. Here is my cod

Dim oWord As New Word.Applicatio
'open the fil
oWord.Documents.Open(fileName, False, False) 'OBJECT REFERENCE ERROR OCCURS HER
'add the custom propert
oWord.ActiveDocument.CustomDocumentProperties.Add(Name:="ProfileID", LinkToContent:=False, Type:=1, Value:=myID
'save the documen
oWord.ActiveDocument.Save(
'close the documen
CType(oWord.ActiveDocument, Word._Document).Close(
'close Wor
CType(oWord, Word._Application).Quit(
'clean u
oWord = Nothin

If the answer is to reference the 10.0 library, how can I do this? I only have the 11.0 libraries available in my reference list

ANY help is greatly appreciated

Thanks.
 
T

Tom Winter

Philip said:
I have a .NET addin that was written on a machine that has Office XP 2003
installed on it which uses the Microsoft Word 11.0 Object library to open
Word and add some custom attributes to an existing Word file. I am now
trying to run that application on a machine that has Office 2002 installed
on it. Should this work? My application seems to fail when trying to use a
reference to the Word Object. This works fine with Office 2003, but not in
Office 2002. Here is my code
Dim oWord As New Word.Application
'open the file
oWord.Documents.Open(fileName, False, False) 'OBJECT REFERENCE ERROR OCCURS HERE
'add the custom property
oWord.ActiveDocument.CustomDocumentProperties.Add(Name:="ProfileID",
LinkToContent:=False, Type:=1, Value:=myID)
'save the document
oWord.ActiveDocument.Save()
'close the document
CType(oWord.ActiveDocument, Word._Document).Close()
'close Word
CType(oWord, Word._Application).Quit()
'clean up
oWord = Nothing

If the answer is to reference the 10.0 library, how can I do this? I only
have the 11.0 libraries available in my reference list.
ANY help is greatly appreciated.

Thanks.

I don't know much about .NET, but my understanding is that you have to code
for a specific version of Office and it won't work with other versions
(unless you build your own shims and goofy stuff like that). The best place
to ask this question is in microsoft.public.vsnet.vstools.office.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top