I would just do this in the Valid for the Editbox instead. Use ALINES() to populate an array with the contents of the editbox. If alen() of the array is greater than three, then they've got too many lines. Then loop through each row of the array and see if the len() greater than 40.