我使用office 2011在我的mac上写了这个小宏。我没有看到任何状态栏。有谁知道为什么这不起作用?
Sub testStastusBar()
Application.DisplayStatusBar = True
Application.StatusBar = "Now processing...."
Dim n As Integer
For n = 1 To 10
Application.Wait (Now + TimeValue("0:00:01"))
Debug.Print n
Next n
Application.StatusBar = False
End Sub
答案 0 :(得分:4)
要使其与Excel 2011一起使用,请在更新状态栏后添加DoEvents
。
Sub testStastusBar()
Application.DisplayStatusBar = True
Application.StatusBar = "Now processing...."
DoEvents '<~~ Add This
Dim n As Integer
For n = 1 To 10
Application.Wait (Now + TimeValue("0:00:01"))
Debug.Print n
Next n
Application.StatusBar = False
End Sub