Close userform with escape button

后端 未结 4 1438
-上瘾入骨i
-上瘾入骨i 2020-12-06 06:37

I have 2 questions.

  1. When I pressed esc button then close Userform1

  2. When I input open in TextBox1

4条回答
  •  无人及你
    2020-12-06 07:01

    1. Insert a new Command Button
    2. Switch its Cancel property to True
    3. You May Name it as cmdClose
    4. Add next code:

      Private Sub cmdClose_Click()
      
          Unload Me
      
      End Sub
      

    5.Set height and widht of the button to 0

    that's it

提交回复
热议问题