vba 当倒计时器计时到0时自动写一段数据到textbox,这段数据包括当前系统时间及一个固定语句

vba 当倒计时器计时到0时自动写一段数据到textbox,这段数据包括当前系统时间及一个固定语句,下面是我倒计时和到180秒时show userform的代码,麻烦请教如果我要在下面这段代码上修改,应该如何写,谢谢!
t=time
TTime = Format(TimeValue("00:30:00") - Time + t, "hh:mm:ss")
string = CStr(TTime)
syms = Int(Left(string, 2)) * 3600 + Int(Mid(string, 4, 2)) * 60 + Int(Mid(string, 7, 2))
If syms < 180 Then
If flag7 Then
If UserForm1.Visible = False Then UserForm1.Show 1
flag7 = False
End If
End If

这段代码能够实现你的show userform的效果吗?你所编辑的未经调试。

增加自动填写数据到textbox的内容,文件在D盘下,内容为当前时间和"固定内容"。试着调试一下。

if syms=0 then
Dim Myo As Object, Mfile As Object

Set Myo = CreateObject("Scripting.FileSystemObject")
Set Mfile = Myo.OpenTextFile("D:\testfile.txt", 2, True)
Mfile.Write Time() & "固定内容"
Mfile.Close
Set Myo = Nothing
Set Mfile = Nothing
end if
温馨提示:答案为网友推荐,仅供参考