我为Word和Excel构建VBA应用程序,有什么方法可以访问有时出现在Office状态栏中的进度栏。如何访问Office应用程序状态栏中的进度栏
4
A
回答
4
下面将模拟在Excel的状态栏进度条:
Public Sub UpdateStatusBar(percent As Double, Optional Message As String = "")
Const maxBars As Long = 20
Const before As String = "["
Const after As String = "]"
Dim bar As String
Dim notBar As String
Dim numBars As Long
bar = Chr(31)
notBar = Chr(151)
numBars = percent * maxBars
Application.StatusBar = _
before & Application.Rept(bar, numBars) & Application.Rept(notBar, maxBars - numBars) & after & " " & _
Message & " (" & PercentageToString(percent) & "%)"
DoEvents
End Sub
0
我没有访问的进度条,但我在使用像这样的地方在状态栏中任务状态的文本过去......
Sub StatusBarExample()
Application.ScreenUpdating = False
' turns off screen updating
Application.DisplayStatusBar = True
' makes sure that the statusbar is visible
Application.StatusBar = "Please wait while performing task 1..."
' add some code for task 1 that replaces the next sentence
Application.Wait Now + TimeValue("00:00:02")
Application.StatusBar = "Please wait while performing task 2..."
' add some code for task 2 that replaces the next sentence
Application.Wait Now + TimeValue("00:00:02")
Application.StatusBar = False
' gives control of the statusbar back to the programme
End Sub
2
我会建议此外,记录StatusBar的当前状态,然后在完成所有事情时恢复它。
Dim OldStatus
With Application
OldStatus = .DisplayStatusBar
.DisplayStatusBar = True
.StatusBar = "Doing my duty, please wait..."
End With
' Do what you do best here (you can refresh the .StatusBar message with updted, as needed)
With Application
.StatusBar = False
.DisplayStatusBar = OldStatus
End With
0
据我所知,是没有办法复制打开文件时使用的Word Excel的&显示进展100%,例如点的蓝线。
我记得曾经看到一些代码在状态栏中复制它,但它很复杂,我不会推荐它,当它足够代替状态栏中的“X%complete”时,使用Application.StatusBar。
相关问题
- 1. 更新状态栏内的进度栏
- 2. Excel VBA进度/状态栏
- 3. 如何使状态栏应用程序捕获“applicationDidResignActive:”与其他状态栏应用程序?
- 4. iPhone应用程序 - 隐藏状态栏
- 5. 应用程序状态栏更新
- 6. 如何隐藏Iphone应用程序中的状态栏
- 7. 如何在Java应用程序的底部创建一个栏,如状态栏?
- 8. 如何使Chrome应用程序显示在停靠栏/状态栏中
- 9. iOS7如何在应用程序中完全隐藏状态栏?
- 10. 如何在OS X Yosemite中开发状态栏应用程序?
- 11. 如何在iOS应用程序中隐藏状态栏?
- 12. 如何在ASP.NET应用程序中实现状态栏?
- 13. 如何在状态栏中添加自定义应用程序?
- 14. 如何以编程方式打开状态栏应用程序?
- 15. 如何在状态栏中调用进度条?
- 16. 如何在React-Native应用程序中检索iOS状态栏高度?
- 17. 如何修改状态栏的高度?
- 18. 状态栏的高度?
- 19. 使用Mac状态栏的程序
- 20. 如何改变状态栏上模态访问的iOS 6
- 21. 访问位置服务时,Android应用程序缺失状态栏图标
- 22. HomeScreen web应用程序中的iOS 8状态栏叠加+页脚'栏'
- 23. 如何在状态栏中获得PERMANENT应用程序通知程序?
- 24. 从状态栏应用
- 25. 如何检测双高度状态栏?
- 26. 如何在Microsoft Office联机查看器中隐藏状态栏
- 27. 如何透明软键栏和透明状态栏的高度?
- 28. 如何获取状态栏和软键按钮栏的高度?
- 29. 如何在线程中访问应用程序状态?
- 30. 更新状态栏中的时间 - iOS应用程序