Input Box - 'Cancel' (A2k2)

I am using an input box to get an e-mail address from a user. If the user selects "Cancel" from the buttons available on the form, it just keeps right on going in the routine. Is there a value that gets returned from the cancel button similar to a MSGBOX control? I want it to basically exit the routine.

Re: Input Box - 'Cancel' (A2k2)

The InputBox function returns a string. If user hits "Cancel", presses ESC key, or selects "OK" w/o entering any text, the function will return a zero-length string. The Len() function is simplest way to test to see if response received from user. Example:

Re: Input Box - 'Cancel' (A2k2)

I got in habit of using Len() to test for zero-length strings because (as noted in ADH and elsewhere) it is less "work" for VBA to look up the length of the string, which is stored in the 4 bytes preceding the actual byte array of characters, than to compare a string to "" or some other value. Although in this case any increase in "efficiency" would be neglible if not nonexistent. Efficiency aside, I tend to avoid using "" where practical because it makes the code more readable (e.g., using vbNullString to initialize strings, etc).