VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Run-Time Error 424

1 REPLY 1
Reply
Message 1 of 2
Anonymous
884 Views, 1 Reply

Run-Time Error 424

Sometimes I get a run-time error when I try to run my VBA routines (message attached). Anyone know why I get this sometimes but not all the time? Most of the time all my routines work fine. They even run from VBAIDE without any problems it's just when I try to call them in cad through LISP's or the command line?
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

There could be many possible reasons for that error, but is almost certain
That it is your VBA code runs into a situation that you did not expect,
where the code is trying to access an object's property or call an object's
method. For example, you want to get a layer's color, but the variable of
AcadLayer type is not set to an existing AcadLayer object (or the layer you
refered to by name does not exist...). Anyway, without seeing your code it
is hard to say what is the reason other than being sure that it is your VBA
code.

Obviously, you have On Error Goto (Resume) in your code. When next time the
error msg pops up again, simple go to VBA IDE and click menu
"Tools->Options..." and on "General" tab, select "Break on all error". Then
re-run the macro in exact step to re-produce the error. This time you will
get error mesaage pops up with "Debug" option. Clicking "Debug" will lead
you to the offending line of code (in most cases, occassionally, the
highlighted line of code is not the offending one). Carefully analyze the
code to find out why the object variable is not set.

wrote in message news:4882316@discussion.autodesk.com...
Sometimes I get a run-time error when I try to run my VBA routines (message
attached). Anyone know why I get this sometimes but not all the time? Most
of the time all my routines work fine. They even run from VBAIDE without any
problems it's just when I try to call them in cad through LISP's or the
command line?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost