所以我一直在寻找一种方法来临时显示excel中的文本框。基本上,我在用户点击按钮后尝试显示文本5秒钟。我不希望任何人为我做代码#34;而是给我指点。用户单击按钮以切换语言。按下该按钮时,我想要显示一条消息:"所有值都已重置"。我的问题如下:excel-vba中是否有一个函数在消失或将其可见性值变为false之前显示文本框一段时间?
所有用于切换语言的代码已经完成了我真的只是想找到一个能够在一段时间后关闭可见性的功能。 (计时器或我不知道)
我怀疑显示我到目前为止的代码会有所帮助,但如果您希望看到它,请在评论中注明。
谢谢你
到目前为止,这是我的代码:
Private Sub Ok_Click()
startTimer
Unload Me
End Sub
Sub startTimer()
Application.OnTime Now + TimeValue("00:00:01"), "NextTime"
End Sub
Sub NextTime()
If Sheet3.Range("B5") = 0 Then reset
If Sheet3.Range("B5") = 0 Then Exit Sub
Sheet3.Range("B5").Value = Sheet3.Range("B5").Value - TimeValue("00:00:01")
startTimer
End Sub
Sub reset()
Sheet3.Range("B5") = ("00:00:05")
End Sub
答案 0 :(得分:1)
考虑:
Sub MAIN()
Call BoxMaker
DoEvents
DoEvents
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 5
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
ActiveSheet.Shapes("SPLASH").Delete
End Sub
Sub BoxMaker()
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 217.5, 51#, _
482.25, 278.25).Select
Selection.Name = "SPLASH"
Selection.Characters.Text = "Please Wait for Macro"
With Selection.Characters(Start:=1, Length:=21).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 36
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.HorizontalAlignment = xlCenter
Selection.VerticalAlignment = xlCenter
End Sub