本文介绍了隐藏后如何返回或重新显示用户表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在UserForm2的一个命令按钮中有以下代码:
I have this code in one command button in UserForm2:
Private Sub CButton1_Click()
UserForm1.Show
Me.Hide
End Sub
现在,显示Userform1
.
然后在Userform1的一个命令按钮中有另一个代码:
Now, Userform1
is shown.
Then I have another code in one command button in Userform1:
Private Sub CButton2_Click()
UserForm2.Show
Unload Me
End Sub
这引发了一个:
如何正确执行此操作?
隐藏或卸载后如何返回上一个Userform
?
How do I do this properly?
How do I go back to the previous Userform
after hiding or unloading it?
推荐答案
我认为问题在于语句的顺序.我使用调试器发现,当我在隐藏"或卸载"之前有显示"语句时,这些最后一个语句不会执行.
I think the problem is the order of the statements. I found out by using the debugger that when I had the Show statements before the Hide or Unload, these last are not executed.
尝试一下
' on UserForm2
Private Sub CommandButton1_Click()
Me.Hide
UserForm1.Show
End Sub
' on UserForm1
Private Sub CommandButton1_Click()
Me.Hide
UserForm2.Show
End Sub
这篇关于隐藏后如何返回或重新显示用户表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!