Indeed, theDBGuy is correct. It's valid to do a "If Len(string) Then", but the converse can't be true, not without a proper logical operator, anyway. The "Not" is technically bitwise and not logical. Let's put this that way: what is the result of "Not 1"? Put it in your immediate windows:
CODE
?Not 1
-2
-2 is the bitwise negation of 1. This seems bizarre but rest assured, it's not when you look at how we represent numbers. Assuming we're working with Long Integer, the value of 1 would be probably something like this:
CODE
00000000 00000000 00000000 00000001
(Note: for simplification, I'm neglecting the endianness; the actual representation is different in an little endian platform like x86)
When we negate it, the result becomes:
CODE
11111111 11111111 11111111 11111110
That looks logical, right? But why -2? Well, the leftmost bit is actually special - it's used to denote whether a number is a negative number or not. In our first example, the leftmost bit was 0, so the "1" was positive. Next question - what is the biggest positive number? This would be all 1s save leftmost bit being zero as thus:
CODE
01111111 11111111 11111111 11111111
In decimal value, that's 2147483647. So when we add one more bit, returning this:
CODE
10000000 00000000 00000000 00000000
The decimal value is now -2147483648, which is the largest negative number allowed for this size of integer. As we add one more bit, the negative numbers decrement, until we get this:
CODE
11111111 11111111 11111111 11111111
which is of course, -1. So back to us negating the binary representation of 1 - if you notice that rightmost bit is 0, so that's one value less than -1, which is of course, -2.
So when you do a "Not Len(string)", you are getting a bitwise negation, so if it's a nonzero number, it may result in another nonzero number which happens to be the two complement. So why did Len(string) work? Well, if you look at most programming languages, there's a near universal agreement (I'd say total as I do not know of any language that doesn't go by same agreement but...) that the definition of FALSE is of course, zero. What about TRUE? Well, they define it as NOT FALSE (in logical sense, not bitwise). This is why some may define True as 1, other as -1 but that doesn't matter. When we do something like "If Len(string) Then", what we are actually saying is "If Len(string)<>0 Then". Thus, True can appear to be basically any nonzero number but that's only because we found it more convenient to test for FALSE (zero) than to test for any non zero numbers.
Therefore, if you want to use implicit evaluations:
For any non-ZLS string:
CODE
If Len(string) Then
For any ZLS string:
CODE
If Len(string) = 0 Then
What you don't want to try and use bitwise operators as if they were logical. They seems similar but they are not same thing. Hopefully it also explains why it doesn't follow that the converse of "If Len(string) Then" won't work same way.
Then OTOH, being more explicit as theDBGuy suggests makes your code more easier to read and self-documenting.
Anyway, hope that helps.