2013-10-18 43 views
0

我有一個查詢,我通過循環遍歷每個記錄通過VBA進行處理。運行需要一段時間,用戶不耐煩。對他們來說,程序似乎鎖定了。如何控制狀態欄向用戶顯示查詢正在進行並正在工作?顯示正在狀態欄中處理的記錄

我想讓它顯示是這樣的:

TOTAL RECORDS 95551, PROCESSING: 85 

在上面的例子中的85會增加一路攀升,直到它達到了95551.

回答

4

下面應該做的是什麼,你是尋找。在視覺上,進度條也會相應地移動。

Dim tempRN AS Long, tempRT AS Long 

tempRN= 1 

'Get the total number of records that you need to work with and assign to tempRT 

Application.SysCmd acSysCmdInitMeter, "TOTAL RECORDS " & tempRT & ", PROCESSING: " & tempRN, tempRT 

Do While ....... 
    'Do whatever it is you need to do 

    tempRN = tempRN + 1 
    Application.SysCmd acSysCmdRemoveMeter 
    Application.SysCmd acSysCmdInitMeter, "TOTAL RECORD COUNT " & tempRT & ", PROCESSING: " & tempRN, tempRT 
    Application.SysCmd acSysCmdUpdateMeter, tempRN 
Loop 

Application.SysCmd acSysCmdRemoveMeter 
+0

很好,謝謝 –