vico
vico

Reputation: 18251

method list from COM object

I'm trying to use COM object in following way:

Dim l
l = CreateObject("tst.Ax")
Dim err As Long
Dim st As ULong

Try

   l.AX_hdr(st, err)

   Catch ex As Exception
   MsgBox(ex.Message)
End Try

And I have error

TYPE_E_ELEMENTNOTFOUND

CreateObject works correctly, because this COM object executes some code during initialization (shows messagebox). Object should have method AX_hdr, but I don't have any idea why it can't find it. What else might be wrong? Is there are any method how to retrieve function list from COM object?

Upvotes: 0

Views: 231

Answers (1)

Matt Wilko
Matt Wilko

Reputation: 27342

If you add a reference to your COM component, you can instantiate the object using early binding:

Dim l as new tst.Ax

You will then have intellisense for all the method and properties of the component or you can press F2 to do a search using the Object Browser.

You can always remove the reference at a later date if you wish but early binding is usually preferable. I would only use late binding if you have a good reason to or not other option.

Upvotes: 2

Related Questions