求大佬指点代码
vba吧
全部回复
仅看楼主
level 4
想做一个倒计时显示,点击按钮在text上显示倒计时数字,功能是实现了,但是只能点一次,下一次点击就不动作了。求教!(PPT中的vba)
2024年07月30日 16点07分 1
level 4
Private Sub CommandButton1_Click()
If CommandButton1.Caption <> "开始" Then
CommandButton1.Caption = "开始"
Else
CommandButton1.Caption = "结束"
i = 10
Label1.Caption = 10
Do While i > 0
DoEvents
Label1.Caption = i
i = i - 1
Application.Wait (Now + TimeValue("00:00:01"))
If i = 0 Or CommandButton1.Caption = "开始" Then
CommandButton1.Caption = "开始"
Exit Sub
End If
Loop
End If
End Sub
2024年07月31日 03点07分 2
感谢大佬,解决了,是因为我全局变量b没有赋初值0,这个是ppt,没有wait方法,十分感谢!
2024年07月31日 04点07分
level 1
blog.csdn.net/weixin_44386796/article/details/140840513?spm=1001.2014.3001.5502
这个是我写的,你参考一下
2024年08月01日 04点08分 3
感谢兄弟!
2024年08月02日 06点08分
1