Bonjour,
Dans son message, < vijaya sekhar vasa > écrivait :
In this message, < vijaya sekhar vasa > wrote:
|| helo,
||
|| I am trying to scan 100 word files in a folder and while scanning , I
|| would like to display the amount of time it is taking to scan the
|| whole documents,
|| can anyone please tell me the way to display that in a status bar.
||
I do not know if you can run a macro and simultaneously change the StatusBar
text. I think this would require two macros to run at the same time.
What I know you can do is use a counter, and periodically change the text:
For example:
Application.StatusBar = i & " of 10 documents processed"
To see this in action, try this silly code:
'_______________________________________
Sub ChangeStatusBarText()
Dim i As Long
Dim j As Long
For i = 1 To 10
Application.StatusBar = i & " of 10 documents processed"
j = 0
Do While j < 5000000
j = j + 1
Loop
Next i
End Sub
'_______________________________________
Just declare a counter, and every time you finish a document, increase the
counter by one and change the status text. You can probably find other ways
to increase the counter, depending on what you are actually doing with your
documents.
If you really want the time elapsed, play around with something like:
'_______________________________________
Sub ChangeStatusBarText()
Dim i As Long
Dim j As Long
Dim MyTime As Single
Dim ElapsedTime As Single
MyTime = Timer
ElapsedTime = 0
For i = 1 To 20
Application.StatusBar = ElapsedTime & " seconds elapsed."
j = 0
Do While j < 5000000
j = j + 1
Loop
ElapsedTime = Format(Timer - MyTime, "0.00")
Next i
End Sub
'_______________________________________
On my machine that takes 13 seconds to run.
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org