Error: 424 Object required

  • Thread starter Thread starter DavidM
  • Start date Start date
D

DavidM

Hi

Can anybody explain the following to me

I have a com dll with a class Object that has a function setParam.
When I call from VBA

Object.setParam(X) gives me Error: 424 Object required

But
Object.setParam X
and
call Object.setParam(X)

both work

and if X is a Double instead of some object the first call above works

I'd really like to understand what is the issue. (Even if I have the fix)

Thanks in advance
 
Because that is the syntax of VBE. You don't put the arguments in
parentheses unless you use the call. If you do, then the argument is
evaluated before it is passed - in your case, you are returning the default
value of X as the argument to SetParam so your object gets dereferenced or
it can't be evaluated perhaps. If X is a double, then it is evaluated, but
that doesn't change what X is - so no problem in that case.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top