invalid use of null

G

Guest

Is there a simple way to determine the cause of a "invalid use of null"
message in debugging? I've stepped through the code and it still won't give
me the specific cause of the error. Any other debugging techniques that might
be able to crack the secret?
 
W

Wayne Morgan

What line gives you the error? Can you copy and paste your code into a
message? Also, if you hold the mouse cursor over the variables and objects
in the code while stepping through it, a tool tip will popup showing the
value of the item you're holding the mouse cursor over.
 
T

Tim Ferguson

Is there a simple way to determine the cause of a "invalid use of null"
message in debugging?

Are you using Option Explicit at the top of all your modules? If you
mistype a variable name without Option Explicit, then vba will

(a) create a new variable
(b) type it as a Variant
(c) leave it uninitialised, and
(d) pass it to the function/ procedure as a Null, which may or may not be
able to cope with it.

Strong typing in VBA can look after you but only if you let it.


All the best


Tim F
 

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

Top