在Excel Vba程序中自制进度条,显示实时进度信息
时间:2010-10-16 来源:缤纷
于是自制了一个,在状态栏显示,效果如图:
代码:
'自定义的进度条,在状态栏显示 Function GetProgress(curValue, maxValue) Dim i As Single, j As Integer, s As String i = maxValue / 20 j = curValue / i For m = 1 To j s = s & "■" Next m For n = 1 To 20 - j s = s & "□" Next n GetProgress = s & FormatNumber(curValue / maxValue * 100, 2) & "%" End Function
调用方式示例:
rs.Open sql, connXls, 1 Dim p As Integer: p = 0 Do While Not rs.EOF p = p + 1 '在状态栏显示 Application.StatusBar = GetProgress(p, rs.RecordCount) ……
非常地实用吧,呵呵。
相关阅读 更多 +