Private Sub UserForm_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)If KeyCode = 27 Then Unload MeEnd Sub
代码写在窗体中