title: GetRef not working if function is loaded at runtime using LoadFunctionLibrary
body: <p>I am trying to execute a function from a functional library (which I am loading at runtime). Everything works if I use <code>Eval</code> or <code>Execute</code> to run the function but I wanted to use <code>GetRef</code> as mentioned in <a href="https://stackoverflow.com/questions/7644792/is-it-possible-to-call-a-function-whose-name-is-stored-in-a-string-in-vbscript">this</a> and <a href="https://stackoverflow.com/questions/13125649/calling-a-function-name-stored-in-a-string-variable">this</a></p>
  
  <p><strong>QTP Code Snippet</strong></p>
  
  <pre><code>Call LoadFunctionLibrary("/../Libraries/Tests.vbs")
  Set objCon = CreateObject("ADODB.Connection")
  objCon.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" &amp; "C:\_Work\WorkingFolder\TestList.xlsx" &amp; "';Extended Properties='Excel 12.0;HDR=YES;IMEX=1';"
  Set objRS = objCon.Execute("Select * from [Sheet1$] Where [To Execute] = 'YES'")
  Do While Not objRS.EOF
       'Eval( objRS.Fields(1).Value)
       'Execute objRS.Fields(1).Value
  
       Set tcFunc = GetRef(objRS.Fields(1).Value)
       tcFunc
      objRS.MoveNext
  Loop
  </code></pre>
  
  <p>In <code>/../Libraries/Tests.vbs</code> file, I have this function</p>
  
  <pre><code>Sub foo()
    msgbox "hello"
  End Sub
  </code></pre>
  
  <p>which is referenced in the Excel as below</p>
  
  <p><a href="https://i.stack.imgur.com/xfmTi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xfmTi.png" alt="enter image description here"></a></p>
  
  <p>When I try to use GetRefm QTP is throwing the below error</p>
  
  <p><code>
  Invalid procedure call or argument: 'GetRef'
  Line (10): "Set tcFunc = GetRef(objRS.Fields(1).Value)". 
  </code></p>
  
  <p>If foo is defined in QTP's Action, then it works but when I import it from a functional library, it fails. Any idea how to make it work?</p>
  
  <p><strong>EDIT -- WORKAROUND SOLUTION</strong></p>
  
  <p>Instead of using <code>LoadFunctionLibrary</code>, use <code>ExecuteFile</code> to load the functional library.</p>