excel vba倒计时器代码转成vb 2010 express代码
各位大虾:下面是我在excel里做一段倒计时器和计时器代码,麻烦请教如果将这段代码的功能转化为vb2010express代码?谢谢!Publicflag1Publicfl...
各位大虾:下面是我在excel 里做一段倒计时器和计时器代码,麻烦请教如果将这段代码的功能转化为vb 2010 express 代码?谢谢!
Public flag1
Public flag2
flag1 = True
flag2 = True
Public Sub red()
States = 1
With Application
.OnTime Now + TimeValue("00:00:01"), "uf"
Call aa
End With
End Sub
Sub uf()
UserForm1.Show 0
End Sub
Sub aa()
Dim bl, be As Boolean
If States = 0 Then
Exit Sub
Else
If bl Then End
UserForm1.TextBox1 = Format(Time - t, "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
If string1 < "00:00:58" Then
flag1 = True
Else
If UserForm5.Visible = False Then UserForm5.Show
flag1 = False
End If
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
If UserForm6.Visible = False Then UserForm6.Show
flag2 = False
End If
End If
With Application
.OnTime Now + TimeValue("00:00:01"), "aa"
End With
End If
End Sub
报错出现在Format(Time - t, "hh:mm:ss")、(Now - t1)、Form2.TextBox2 = "00:00:00"的"00:00:00"、(TimeValue("00:02:00") - Time + t、string1 = CStr(Form2.TextBox2),所有的string1/2都有报错、Form2.TextBox2.ForeColor = 255的255. 展开
Public flag1
Public flag2
flag1 = True
flag2 = True
Public Sub red()
States = 1
With Application
.OnTime Now + TimeValue("00:00:01"), "uf"
Call aa
End With
End Sub
Sub uf()
UserForm1.Show 0
End Sub
Sub aa()
Dim bl, be As Boolean
If States = 0 Then
Exit Sub
Else
If bl Then End
UserForm1.TextBox1 = Format(Time - t, "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
If string1 < "00:00:58" Then
flag1 = True
Else
If UserForm5.Visible = False Then UserForm5.Show
flag1 = False
End If
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
If UserForm6.Visible = False Then UserForm6.Show
flag2 = False
End If
End If
With Application
.OnTime Now + TimeValue("00:00:01"), "aa"
End With
End If
End Sub
报错出现在Format(Time - t, "hh:mm:ss")、(Now - t1)、Form2.TextBox2 = "00:00:00"的"00:00:00"、(TimeValue("00:02:00") - Time + t、string1 = CStr(Form2.TextBox2),所有的string1/2都有报错、Form2.TextBox2.ForeColor = 255的255. 展开
展开全部
Format(Time - t, "hh:mm:ss")、(Now - t1)、 ' t、t1 未定义,不能进行这类操作
Form2.TextBox2 = "00:00:00"的"00:00:00"、‘对象不能赋值文本,对象的某些属性可以,这里应该是text属性
(TimeValue("00:02:00") - Time + t、’ 同前面
string1 = CStr(Form2.TextBox2),所有的string1/2都有报错、‘字符串被赋值成对象,应为TextBox2的text属性
Form2.TextBox2.ForeColor = 255的255.'改成Color.FromArgb(255,0,0)
Form2.TextBox2 = "00:00:00"的"00:00:00"、‘对象不能赋值文本,对象的某些属性可以,这里应该是text属性
(TimeValue("00:02:00") - Time + t、’ 同前面
string1 = CStr(Form2.TextBox2),所有的string1/2都有报错、‘字符串被赋值成对象,应为TextBox2的text属性
Form2.TextBox2.ForeColor = 255的255.'改成Color.FromArgb(255,0,0)
追问
麻烦问下这几处错误的地方应该如何修改呢,麻烦给一下具体修改代码嘛,谢谢,
麻烦问下这几处错误的地方应该如何修改呢,麻烦给一下具体修改代码嘛,谢谢,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |