If I know a bit of data is going to be an Object, but I don't know what kind, I can pass it to a function or routine like this:
Sub mySubExpectingAnObject(myVal As Object)
Which is more explicit than
Sub mySubExpectingAnObject(myVal As Variant)
And should be preferred even if both work
If instead I know the bit of data is not an object, but could be anything else (Long
, Double
, String
etc.), is there any way of Dim
ing the argument as not an object. E.g
Sub mySubExpectingNotAnObject(myVal As NotObject)
Since if I use Variant
here, there will be no automatic anti-object check. Does such a type exist; one that can encapsulate any non-object datatype exclusively? Is there a workaround other than just
If isObject(myVal) Then Err.Raise 5
or similar?