Error in COM Microsoft.Office.Interop

  • Thread starter Thread starter AYAX
  • Start date Start date
A

AYAX

I have an application made in .net. This program link with formfields
in word application.
This is the code:

Dim wdApp As ObjectDim wdDoc As New Word.Document
Dim strLabelName = ruta + "\oferta.dot"

wdApp = CreateObject("Word.Application")

wdApp.Visible = TruewdDoc = wdApp.Documents.Add(strLabelName)

With wdDoc
..FormFields("txt_oferta").Result = oferta
..FormFields("txt_nombre").Result = nombre
end with

In all computers of my enterprise, work perfectly but, in the
manager's computer doesn't work, bad luck :( . The program run well,
but fails when it arrives the line ".FormFields("txt_oferta").Result =
oferta".
the error is
Unable to cast COM object of
type'Microsoft.Office.Interop.Word.DocumentClass' to interface
type'Microsoft.Office.Interop.Word._Document'. This operation failed
because theQueryInterface call on the COM component for the interface
with IID'{0002096B-0000-0000-C000-000000000046}' failed due to the
following error:The application called an interface that was
marshalled for a differentthread. (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).

I installed microsoft office 2003 primary interop assemblies but it
doesn't work.

any ideas?
I'm a little bit desperate. :)

thank you very much.
 
Back
Top