views:

639

answers:

4

I am trying to use the Office COM components in order to create Word and Excel documents. Unfortunately I can not achieve this because I am getting an error.

Cannot find IDispatch for '{00020906-0000-0000-C000-000000000046}' in module '{00020905-0000-0000-C000-000000000046}', v8.3

I tried reinstalling Office, my application (ALBPM) and my interface (combsvc) but it is not working.

I want to know how can I install IDispatch, or how can I know if it is installed in the correct module. Some times the error says:

Cannot find IDispatch for '{000209FF-0000-0000-C000-000000000046}' ... instead of 00020906-0000-0000-C000-000000000046

The code I'm using generate these errors is:

wordAppl.visible = false
wordDocs = wordAppl.documents

contratoTemplate = "C:\\albpmFiles\\mandatory\\aTemplate.doc"
// .doc template
convenioTemplate = "C:\\albpmFiles\\mandatory\\ConvenioModificatorio.doc"
// .doc template
saveContrato = "C:\\albpmFiles\\temp\\"
// where to save.
saveConvenio = "C:\\albpmFiles\\temp\\"

contratoName = "NewContact.doc"
wordDoc = open(wordDocs, fileName : contratoTemplate)
bookmark = item(wordDoc.bookmarks, index : "atrDescripcion")

insertAfter bookmark.range
using text = instSolicitud.atrDescripcion
bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrNombre")
insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrNombre
bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrDireccion")
insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrDireccion
filename = saveContrato + contratoName

end

// Extras - Fin
saveAs wordDoc
using fileName = filename

Any information you have about the IDispatch, or these registry entries, well be very appreciated, even if you can tell me where to find more info about this.

Thanks a lot. Daniel.

+2  A: 

From the error you get I assume that you are using Word 2003.

Have you made sure that the COM brigde service is correctly installed and running?

combsvc -install
combsvc -start

will register combsvc as service and then start it.

Please also have a look at the example for Word at the bottom of page 150 in the ALBPM Reference Guide.

The fact that it is sometimes working and sometimes could be an issue with ALBPM. Are you using the latest version and updates?

Another option - and quite frequent problem with Word automation - would be that the automated instance of Word is displaying a modal dialog box and is waiting for user interaction. You can switch of the display of modal dialogs by setting

Application.DisplayAlerts = 0

However, this will unfortunately not prevent all popups from being displayed.

Is there actually an instance of Word started? If so, can you make the Window visible and see if documents can be opened or if there is a popup blocking the application?

0xA3
You are right, I am using Word 2003. In the other hand I am not using .Net I am using a different application that imports COM components, COMBridge:http://edocs.bea.com/albsi/docs60/studio/index.html?t=studio/catalog/catalog_component/COM/c_COM_Bridge.htmleven tough the Feature is installed
Yes, the service is properly running, and my code is according to the reference you sent. The thing is that I think that the combridge is somehow misspointing to a different module in the registry. And I dont know how to configure that.
No, the error is raising even before I reach the code. I think it can not even connect. I have a log at the beginning of the code but i can´t even see it.So I guess is not the code but the connection
Did you follow the steps on p150 (Cataloging a COM Component) in that pdf document to configure the Word type libraries? What library did you choose?
0xA3
Yes I followed the steps. The library I chose is: Microsoft Word 11.0 Object Library
Sounds correct... so the problem must be somewhere else...
0xA3
Btw, what are you actually doing with Word/Excel? Maybe there are better ways to solve the problem than using the COM bridge. Sounds slow and error prone anyway...
0xA3
Well, I just take a template, insert some data and save it with a new name
A: 

To inspect installed COM Interfaces on your PC i suggest you download oleview.exe which is part of the Windows 2003 resource Kit

I actually have {00020906-0000-0000-C000-000000000046} but also no IDispatch interface and get a "Class not registered" error when trying to create an instance of it. My home PC doesn't have office installed just the Office tools which is most likely the cause.

In the past when automating Office Applications i was always able to talk to a version independent ProgID's such as "Excel.Application". Are you sure your referencing the right COM Objects ? Check it out in oleview or give us some more code to munch on :)

Martijn Laarman
+1  A: 

Daniel,

I'm taking a stab in the dark here. It looks like you're using BEA systems Aqualogic BPM which I have a feeling is a Java based tool. From digging about it looks like combsvc is actually a COM bridge service to allow ALBPM to speak to COM from Java:

http://edocs.bea.com/albsi/docs60/studio/index.html?t=studio/catalog/catalog_component/COM/c_COM_Bridge.html

I'm thinking this is your point of failure.

About your question on IDispatch, you don't actually install IDispatch. IDispatch is a interface used by COM to expose objects, methods and properties to late bound COM automation clients such as scripting languages (e.g. ASP or VBScript). It's part of the infrastructure of COM, if this was broken you'd see lots more problems with your machine.

I'd probably advise popping a question in here:

http://forums.oracle.com/forums/forum.jspa?forumID=560

Kev
You are right, im using ALBPM and it's java based. I agree that this could be the point of failure, but unfortunatly it is a closed component, so I guess I need to check if the registries exists where the combridge is looking?
A: 

The code I am using is this, but I can not even see the first log, so I assume there´s an error with the conection, not with the code

wordAppl.visible = false
wordDocs = wordAppl.documents



contratoTemplate = "C:\\albpmFiles\\mandatory\\aTemplate.doc"

// .doc template
convenioTemplate = "C:\\albpmFiles\\mandatory\\ConvenioModificatorio.doc"

// .doc template
saveContrato = "C:\\albpmFiles\\temp\\"

// where to save.
saveConvenio = "C:\\albpmFiles\\temp\\"


contratoName = "NewContact.doc"

wordDoc = open(wordDocs, fileName : contratoTemplate)


bookmark = item(wordDoc.bookmarks, index : "atrDescripcion")

insertAfter bookmark.range
using text = instSolicitud.atrDescripcion

bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrNombre")

insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrNombre

bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrDireccion")

insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrDireccion


filename = saveContrato + contratoName


end



// Extras - Fin
saveAs wordDoc
using fileName = filename
If you remove all of the code and only leave the first log message, do get an entry in the log then?
0xA3
Where and how do you create the wordAppl object? Btw, the samples from the documentation use a different syntax for opening a Word document (open worddocs usingfileName = "C:\\tmp\\input.doc" returning worddoc) . Is yours correct, too?
0xA3
I added this code to your main question. In the future, this space here is reserved for "Answers" to your question. So it would only be appropriate to post here if you discovered the answer to your own question and wanted tos hare. Otherwise just edit the original question.
Simucal
@divo. Yeap, they're equivalent. That tool have several "code" options, I has VB.net like, java like, "CIL" for ( common integration language ) that is the one you mentioned, and PBL that is the one Daniel is using.
OscarRyz