Thanks for this info.
Also, now that this has caught my interest here is QTP script that can be executed (if you don't have the Print utility then change the Print statements to Reporter.ReportEvent statements) that shows it makes no difference how a called function's input parm is declared, when that function invalidates a passed object reference, i.e. the passed reference is always by value because a new reference is created when the function is call.
I know what I just said above is confusing (a more skilled writer could probably do better) but the bottom line is: "you can't invalidate an object reference by calling a function that performs a Set blah=Nothing" statement". Run the code below twice to convince yourself:
1. on first pass comment out "Function objToNothing (byRef refB)" and uncomment "Function objToNothing (byVal refB)".
2. On the second pass reverse the above.
In both runs the output will be the same:
interation #0, refA references a fooClass Object
interation #1, refA references a fooClass Object
interation #2, refA == Nothing
Set refA=new fooClass 'create a single fooClass object; also init refA to reference this object
'Function objToNothing (byVal refB)
Function objToNothing (byRef refB) 'NOTE: no matter how refB parm is declared a 2nd reference
set refB=Nothing ' is always passed to this function
For i=0 to 2
If typeName(refA)="Nothing" Then
Print "interation #"&i&", refA == Nothing"
Print "interation #"&i&", refA references a "&typeName(refA)&" Object"
If i=0 Then