如何在 Excel VBA 中创建进度条? [英] How can I create a progress bar in Excel VBA?
问题描述
我正在开发一个 Excel 应用程序,需要从数据库更新大量数据,因此需要时间.我想在用户表单中制作一个进度条,并在数据更新时弹出.我想要的条只是一个蓝色的小条,左右移动并重复直到更新完成,不需要百分比.
I'm doing an Excel app that needs a lot data updating from a database, so it takes time. I want to make a progress bar in a userform and it pops up when the data is updating. The bar I want is just a little blue bar moves right and left and repeats till the update is done, no percentage needed.
我知道我应该使用 progressbar
控件,但我尝试了一段时间,但无法实现.
I know I should use the progressbar
control, but I tried for sometime, but can't make it.
我的问题是 progressbar
控件,我看不到进度条.它只是在表单弹出时完成.我使用循环和 DoEvent
但这不起作用.另外,我希望该过程重复运行,而不仅仅是一次.
My problem is with the progressbar
control, I can't see the bar 'progress'. It just completes when the form pops up. I use a loop and DoEvent
but that isn't working. Plus, I want the process to run repeatedly, not just one time.
推荐答案
过去,在 VBA 项目中,我使用带有背景颜色的标签控件并根据进度调整大小.可以在以下链接中找到一些具有类似方法的示例:
In the past, with VBA projects, I've used a label control with the background colored and adjust the size based on the progress. Some examples with similar approaches can be found in the following links:
- http://oreilly.com/pub/h/2607
- http://www.ehow.com/how_7764247_create-progress-bar-vba.html
- http://spreadsheetpage.com/index.php/tip/displaying_a_progress_indicator/
这是一个使用 Excel 的 Autoshapes 的:
Here is one that uses Excel's Autoshapes:
http://www.andypope.info/vba/pmeter.htm
这篇关于如何在 Excel VBA 中创建进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!