Re: Installation of program that uses Microsoft.Office.Interop

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Ken Tucker [MVP] (vb2ae_at_bellsouth.net)
Date: 08/21/04


Date: Sat, 21 Aug 2004 06:27:17 -0400

Hi,

            You must either require the user have the same version of office
or use late binding.

Ken
----------------
"William LaMartin" <lamartin@tampabay.rr.com> wrote in message
news:e9e7pVyhEHA.632@TK2MSFTNGP12.phx.gbl...
I have created a program that allows for the automation of things in Word
documents, like changing the values of DocVariables and the links to Excel
Sheets. I did it using interoperoperatability, where, after adding a
reference to Microsoft.Office.Core and a reference to Microsoft Word I
declare objects as follows:

Dim oWordApp As New Microsoft.Office.Interop.Word.Application, .

Everything works fine on the development computer (Office 2003 is in use
here). But when I install the program on a computer running Windows ME
(Office 2002 in use here), the following happens.

1. The program opens fine. I am also able to start an instance of
Microsoft Word via the program, but when I attempt to open a specific
document with Word I get the error: "Object reference not set to an
instance of an object."

 Dim docPath As New Object
        Me.OpenFileDialog1.Filter = "Word files (*.doc)|*.doc"
        If Me.OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            docPath = Me.OpenFileDialog1.FileName
        End If
        oWordApp.Visible = True
        oWordApp.Documents.Open(docPath) 'Error occurs here

As a point of information, the following DLL's are installed in the
Application folder by the installation:

Interop. Microsoft.Office.Core.dll
Microsoft.Ofifice.Infterop.Excel.dll
Microsoft.Ofifice.Infterop.Word.dll
Microsoft.Vbe.Interop.dll
office.dll
stdole.dll

Is there a problem with using these DLLs above generated by Visual Studio?
I read this at Microsoft:

"You must also avoid the use of any Office XP COM interop assembly that is
generated by Microsoft Visual Studio .NET at design time. Any Office XP
interop assembly that is not included in the Office XP PIAs download is
considered unofficial."


Quantcast