views:

152

answers:

2

I am working with VBA, in Microsoft Office 2007 and 2003 (Word specifically).

What I need is to use a custom COM object from VBA and use its methods. I already do it in Word 2007 but it crashed in Word 2003.

This is the command that I am using:

    Dim oCOM as Object.

    Set oCOM = CreateObject("COMDLL.COMObj")

I got this error:

File or assembly name COMDLL, or one of its dependencies, was not found.

How to make it work for Office 2003?

+3  A: 

You might need to use regsvr32 to register the COM component if you have just copied the file to the Word 2003 machine.

E.g.:

    regsvr32 yourcomfilesname.dll
TFD
Well I register it with RegAsm.exe and it works fine with Word 2007, even I did it for Power Point 2003 and 2007 and in all these cases it works perfectly but with Word 2003 it didn't work.
Ubalo
+1  A: 

The Problem was not create the COM object, It was an Office bug so I fixed it with a Microsoft update for Office 2003.

Here is the update URL:

Update for Office 2003 (KB907417)

Ubalo
If you can use the COM object in VBscript but it bombs in VBA, then this is usually the solution.
burnside