Well.. the proble as Lonkero pointed out already...Is that you use "End if" in your original posted code. This is not a valid kix command. You need to use "Endif" with no space.