因此,我一直在到处寻找一种在excel中临时显示文本框的方法。基本上,我想要在用户单击按钮后显示文本5秒钟的内容。我不希望任何人“为我做代码”,而是给我指点。用户单击按钮以切换语言。当按下该按钮时,我希望显示一条消息:“所有值均已重置”。我的问题如下: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
考虑:
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
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句