Check if within Function Wizard
If you have a User Defined Function that requires a long time to
evaluate, the use of the Function Wizard could be really annoying as
it recalculates at every key stroke.
A way to avoid it is to check if the following function at the
beginning of each of your UDF.
------------------------------------------------------------
Function InsideWizard() As Boolean
Dim ActiveWndHandle As Long
Dim ParentWndHandle As Long
Dim ActiveWndProcessId As Long
Dim ParentWndProcessId As Long
Dim Result As Long
ActiveWndHandle = GetActiveWindow()
If ActiveWndHandle = 0 Then Exit Function
ParentWndHandle = GetParent(ActiveWndHandle)
If ParentWndHandle = 0 Then
InsideWizard = False
Exit Function
End If
Result = GetWindowThreadProcessId(ActiveWndHandle,
ActiveWndProcessId)
Result = GetWindowThreadProcessId(ParentWndHandle,
ParentWndProcessId)
If ParentWndProcessId = ActiveWndProcessId Then InsideWizard =
True Else InsideWizard = False
End Function
---------------------------------------------------------------
|