Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in COM Microsoft.Office.Interop

Status
Not open for further replies.

ayaxrm

Programmer
Dec 11, 2008
11
ES
I have an application made in .net. This program link with formfields in word application. This is the code:

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

wdApp = CreateObject("Word.Application")
wdApp.Visible = True
wdDoc = 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 the
QueryInterface 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 different
thread. (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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top