https://cloud.tencent.com/developer/article/1870629?share_token=9370A677-6904-40B6-8C06-8EE6D07ECE8B&tt_from=copy_link&utm_source=copy_link&utm_medium=toutiao_ios&utm_campaign=client_share

循环进度条

  1. Option Explicit
  2. Sub test()
  3. Dim i, max
  4. max = 10
  5. For i = 1 To max
  6. Application.StatusBar = GetProgress(i, max)
  7. Call sleep
  8. Next
  9. End Sub
  10. Function GetProgress(curValue, maxValue)
  11. Dim i As Single, j As Integer, s As String
  12. Dim m, n
  13. i = maxValue / 20
  14. j = curValue / i
  15. For m = 1 To j
  16. s = s & "■"
  17. Next m
  18. For n = 1 To 20 - j
  19. s = s & "□"
  20. Next n
  21. GetProgress = s & FormatNumber(curValue / maxValue * 100, 2) & "%"
  22. End Function
  23. Sub sleep()
  24. Dim newHour, newMinute, newSecond, waitTime
  25. newHour = Hour(Now())
  26. newMinute = Minute(Now())
  27. newSecond = Second(Now()) + 1.5
  28. waitTime = TimeSerial(newHour, newMinute, newSecond)
  29. Application.Wait waitTime
  30. End Sub

效果:
插入目录.gif
不足:只针对循环使用

循环进度条——窗体版

https://cloud.tencent.com/developer/article/1534613
https://m.toutiao.com/is/FHfmaFN/
VBA实战技巧30:创建自定义的进度条1