Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyEscape then Unload Me ' If you want it to end the program use this in conjunction with Unload Me: End End IfEnd Sub