我正在尝试以百分比形式显示经过时间的进度,但是当达到[[几乎最终目标(例如0.98或0.99)时,它显示的是100%。
这里是代码。main.Shapes("shape1").DrawingObject.Text = Format(result, "(0%)")
result
从0降到1,00的位置。如果
result
还不是100%,有没有不显示100%的技巧?
result = 0.99999
fmtPattern = "0%"
If result >= 0 And result < 1 Then
decPlaces = Len(CStr(result)) - 4
If decPlaces > 0 Then
fmtPattern = "0." & String(decPlaces, "0") & "%"
End If
End If
main.Shapes("shape1").DrawingObject.Text = Format(result, "(" & fmtPattern & ")")