VBA userform 显示问题
我有一段subaa和subab的代码,两个里分别有两个倒计时,我有时需要从ab转到aa,每个倒计时都会有userformshow出来,aa里面的时间比较ab里面的时间短,...
我有一段sub aa和sub ab的代码, 两个里分别有两个倒计时,我有时需要从ab转到aa, 每个倒计时都会有userform show出来,aa里面的时间比较ab里面的时间短,有时我需要从ab里转向aa,这时aa里的第一个倒计时已经过了,但和aa里第一个倒计时对应的userform 还是会show出来,而且关不掉,麻烦各位帮我解决一个这个问题嘛,我需要当aa里第一个倒计时已经过了之后就不再显示aa里的userform show/.
Sub aa()
If bl Then End
UserForm1.TextBox1 = Format(Time, "hh:mm:ss")
If (Now - t1) * 3600 * 24 > 120 Then
UserForm1.TextBox2 = "00:00:00"
Else
UserForm1.TextBox2 = Format(TimeValue("00:02:00") - Time + t, "hh:mm:ss")
End If
string1 = CStr(UserForm1.TextBox2)
If Int(Left(string1, 2)) = 0 And Int(Mid(string1, 4, 2)) = 0 Then
UserForm1.TextBox2.ForeColor = 255
If flag1 Then
UserForm5.Show
flag1 = False
End If
End If
If (Now - t1) * 60 * 24 > 3 Then
UserForm1.TextBox3 = "00:00:00"
Else
UserForm1.TextBox3 = Format(TimeValue("00:03:00") - Time + t, "hh:mm:ss")
End If
string2 = CStr(UserForm1.TextBox3)
If Int(Left(string2, 2)) = 0 And Int(Mid(string2, 4, 2)) = 0 Then
UserForm1.TextBox3.ForeColor = 255
If flag2 Then
UserForm6.Show
flag2 = False
End If
End If
麻烦各位帮帮忙看看嘛,小弟急用。谢谢 展开
Sub aa()
If bl Then End
UserForm1.TextBox1 = Format(Time, "hh:mm:ss")
If (Now - t1) * 3600 * 24 > 120 Then
UserForm1.TextBox2 = "00:00:00"
Else
UserForm1.TextBox2 = Format(TimeValue("00:02:00") - Time + t, "hh:mm:ss")
End If
string1 = CStr(UserForm1.TextBox2)
If Int(Left(string1, 2)) = 0 And Int(Mid(string1, 4, 2)) = 0 Then
UserForm1.TextBox2.ForeColor = 255
If flag1 Then
UserForm5.Show
flag1 = False
End If
End If
If (Now - t1) * 60 * 24 > 3 Then
UserForm1.TextBox3 = "00:00:00"
Else
UserForm1.TextBox3 = Format(TimeValue("00:03:00") - Time + t, "hh:mm:ss")
End If
string2 = CStr(UserForm1.TextBox3)
If Int(Left(string2, 2)) = 0 And Int(Mid(string2, 4, 2)) = 0 Then
UserForm1.TextBox3.ForeColor = 255
If flag2 Then
UserForm6.Show
flag2 = False
End If
End If
麻烦各位帮帮忙看看嘛,小弟急用。谢谢 展开
展开全部
给你几行我写的代码去研究一下,看懂了也就会改你的问题了。
Private Sub CommandButton1_Click()
UserForm2.Show 0
UserForm2.Move UserForm1.Left + UserForm1.Width, UserForm1.Top
End Sub
Private Sub CommandButton2_Click()
UserForm2.Hide
End Sub
Private Sub CommandButton3_Click()
Unload UserForm2
End Sub
Private Sub UserForm_Initialize()
UserForm1.Show 0
End Sub
更多追问追答
追问
commandbutton2和3是不是一样的功能呢,麻烦解释一下commandbutton1嘛,谢谢
追答
UserForm2.Hide这个是隐藏窗体,它在内存中仍然存在,仍然可以工作
Unload UserForm2这个是卸载窗体,窗体被卸载,不能工作。
UserForm2.Show 0以非模态方式显示窗体
UserForm2.Move UserForm1.Left + UserForm1.Width, UserForm1.Top控制窗体的位置
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询