Why does Showing a UserForm as Modal Stop Code Execution?

后端 未结 5 1622
遇见更好的自我
遇见更好的自我 2020-12-16 02:29

The following VBA code stops at Me.Show. From my tests, it seems that Me.Show stops all code execution, even if the code is inside the UserForm.

5条回答
  •  半阙折子戏
    2020-12-16 03:15

    I was searching for an answer to why I was getting the following error:

    Run time error '5': Invalid procedure call or argument

    when running this line of code:

    UserForm1.Show True
    

    even though this line works:

    UserForm1.Show False
    

    Of course. True is not the same as vbModal! So the simple answer is to use the correct enumerations:

    UserForm1.Show vbModal
    UserForm1.Show vbModeless
    

提交回复
热议问题