Option
Explicit
Public
Type Parameters
Function
As
String
Text
As
String
Number
As
Integer
End
Type
Public
Sub
main()
Dim
tParams
As
Parameters
With
tParams
.
Function
=
"Test_1"
.Text =
"Hallo Welt!"
End
With
Call
CalculateRunTime_Seconds(tParams)
With
tParams
.
Function
=
"Test_2"
.Number = 2
End
With
Call
CalculateRunTime_Seconds(tParams)
End
Sub
Public
Sub
CalculateRunTime_Seconds(
ByRef
args
As
Parameters)
Dim
StartTime
As
Double
Dim
SecondsElapsed
As
Double
StartTime = Timer
Select
Case
args.
Function
Case
"Test_1"
:
Call
Function_Test_1(args.Text)
Case
"Test_2"
:
Call
Function_Test_2(args.Number)
End
Select
SecondsElapsed = Round(Timer - StartTime, 2)
Debug.Print
"This code ran successfully in "
& SecondsElapsed &
" seconds"
End
Sub
Public
Sub
Function_Test_1(
ByVal
Input_1
As
String
)
Application.Wait Now + TimeValue(
"00:00:05"
)
Debug.Print
"Output Function: "
& Input_1
End
Sub
Public
Sub
Function_Test_2(
ByVal
Input_1
As
Integer
)
Application.Wait Now + TimeValue(
"00:00:05"
)
Debug.Print
"Output Function: "
& Input_1
End
Sub