Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bonni Garcia   on Dec 28 In MS Office Category.

  
Question Answered By: Indie Williams   on Dec 28

You have to write code to utilize the progress  bar. You will want to
create a separate module for this. I use the following code, and port it
to all my programs where I use a progress bar. The only changes you will
want to make to the following is the name of the form, and name of your
Progress Bar control.



When you call this procedure, you need to pass through the total count
of what you are processing, along with the current position you are at.
The program will convert these values into percentages.



Sub IncreaseBar(Count As Long, iISBNCount As Long)



Dim Percent As String

Dim PercentLabel As String

Dim NumRecs As String

Dim i As String



'Put integers into strings

NumRecs = iISBNCount

i = Count

'Increase progress bar

Percent = getPercentage(i, NumRecs)

PercentLabel = Percent & "%"

frmISBNCheck!pbConvert.Value = Percent

frmISBNCheck!lblPercent.Caption = PercentLabel ' I also show a
percentage label along side of the control, you don't need this if you
don't want it.

DoEvents



End Sub



Function getPercentage(ProgressBarCurrentValue As String,
ProgressBarMaxValue As String) As String

'calculate Percentage

getPercentage = Format(Val(Val(ProgressBarCurrentValue /
ProgressBarMaxValue) * 100), "0")

End Function

Share: 

 
 
Didn't find what you were looking for? Find more on Why my GIF Animated pics are not animating in userform? Or get search suggestion and latest updates.


Tagged: