为什么 excel 没有隐藏我的形状?
Why excel is not hiding my shape?
我正在使用下面的代码...
Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long)
Sub blink()
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = False
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = True
End Sub
我是不是漏掉了什么?
这很奇怪。添加 DoEvents
解决了问题。我猜 Sleep
在 Excel 有机会隐藏形状之前暂停线程。
Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long)
Sub blink()
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = False
DoEvents
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = True
End Sub
我正在使用下面的代码...
Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long)
Sub blink()
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = False
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = True
End Sub
我是不是漏掉了什么?
这很奇怪。添加 DoEvents
解决了问题。我猜 Sleep
在 Excel 有机会隐藏形状之前暂停线程。
Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long)
Sub blink()
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = False
DoEvents
Sleep 500
ActiveSheet.Shapes("the_shape").Visible = True
End Sub