Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA -- procedures as arguments?
I would like to pass a VBA subroutine as an argument to another VBA
subroutine. If I pass the name of the variable subroutine as a string and execute it using a Run statement in the host subroutine, the result is significantly slower than if I put a Select/Case statement in the host subroutine that directly calls the variable subroutine. E.g., if ProcName1 is a string containing the name of procedure NamedProc1, then Sub HOSTSUB(ProcName As String) Run ProcName End Sub is slower than Sub HOSTSUB(ProcName As String) Select Case ProcName Case ProcName1 NamedProc1 End Select End Sub Is there a better way to handle variable procedures in VBA? Dave Ring |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA -- procedures as arguments?
Dave,
If you pass the procedure name as a string, you can use Application.Run to execute it. E.g., Application.Run ProcName i "Dave Ring" wrote in message ... I would like to pass a VBA subroutine as an argument to another VBA subroutine. If I pass the name of the variable subroutine as a string and execute it using a Run statement in the host subroutine, the result is significantly slower than if I put a Select/Case statement in the host subroutine that directly calls the variable subroutine. E.g., if ProcName1 is a string containing the name of procedure NamedProc1, then Sub HOSTSUB(ProcName As String) Run ProcName End Sub is slower than Sub HOSTSUB(ProcName As String) Select Case ProcName Case ProcName1 NamedProc1 End Select End Sub Is there a better way to handle variable procedures in VBA? Dave Ring |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Separating sub procedures | Excel Discussion (Misc queries) | |||
Pivotcharts and stored procedures | Charts and Charting in Excel | |||
VBA function Procedures.... | Excel Worksheet Functions | |||
VBA functions and Procedures.... | Excel Worksheet Functions | |||
Splitting Procedures | Excel Programming |