Quote Originally Posted by robertx
I use the pass by reference method as follows:

Code:
 Public Sub UpdateProgressBar(ByRef myProgressBar As ProgressBar)
        Dim i As Integer, iRecordCount As Integer

        'Set record count here
         iRecordCount = 100000

        For i = 0 To (iRecordCount - 1)
            'do something here

            'increment progress bar
            myProgressBar.Value = ((i + 1) * 100) / iRecordCount
            Application.DoEvents()
        Next
    End Sub
There is no reason to pass the parameter by reference. You can set properties of the ProgressBar just the same when passing it by value. If you pass it by reference you are enabling the method to pass out a different ProgressBar than what was passed in. That is obviously not what you want.