G
Guest
I've got this code to measure the amount of time a function runs. The code
works fine, but what I'd like to do (if possible), is supply the name of the
function as an argument, so I can use this one function to measure process
times for several different functions.
Somehow, I need my Call statement to "read" the argument supplied, so it can
interactively call the appropriate function to measure. How do I do this?
Function TimeLoop()
Dim sngStart As Single
Dim sngEnd As Single
Dim lngLoop As Long
Dim Msg As String
Dim Ans As Integer
sngStart = Timer
Call macInvUpdate
sngEnd = Timer
'Creates a message box
Msg = "You have successfully refreshed the Inventory table!"
Msg = Msg & vbNewLine & vbNewLine
Msg = Msg & "Process Time: " & Format$((sngEnd - sngStart) / 60, "0.0")
& " minutes"
Ans = MsgBox(Msg, vbInformation, "Refresh Status")
End Function
works fine, but what I'd like to do (if possible), is supply the name of the
function as an argument, so I can use this one function to measure process
times for several different functions.
Somehow, I need my Call statement to "read" the argument supplied, so it can
interactively call the appropriate function to measure. How do I do this?
Function TimeLoop()
Dim sngStart As Single
Dim sngEnd As Single
Dim lngLoop As Long
Dim Msg As String
Dim Ans As Integer
sngStart = Timer
Call macInvUpdate
sngEnd = Timer
'Creates a message box
Msg = "You have successfully refreshed the Inventory table!"
Msg = Msg & vbNewLine & vbNewLine
Msg = Msg & "Process Time: " & Format$((sngEnd - sngStart) / 60, "0.0")
& " minutes"
Ans = MsgBox(Msg, vbInformation, "Refresh Status")
End Function