如何在Excel VBA中创建进度栏? [英] How can I create a progress bar in Excel VBA?

查看:45
本文介绍了如何在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 控件,我看不到"progress"栏.表单弹出时,它就完成了.我使用了循环和 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:

  1. http://oreilly.com/pub/h/2607
  2. http://www.ehow.com/how_7764247_create-progress-bar-vba.html
  3. http://spreadsheetpage.com/index.php/tip/displaying_a_progress_indicator/

以下是使用Excel的自动形状的一种:

Here is one that uses Excel's Autoshapes:

http://www.andypope.info/vba/pmeter.htm

这篇关于如何在Excel VBA中创建进度栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆