title: How to use excel built-in constant in VBS
body: <p>I want to use VBScript to process EXCEL instead of VBA. But I encountered code errors when calling method Range.Find, see below</p>
  
  <pre><code>Function find_range(wb, domain, var)
      Dim sheet
      Dim rg1, rg2, rg3
      Set sheet = wb.Sheets(domain)
  
      Set rg1 = sheet.Range("D:D").Find(var, , xlValues, xlWhole )
  
      If Not rg1 is Nothing Then
          'msgbox rg1.Cells(1,1).row
          Set rg2 = sheet.Cells(rg1.Cells(1,1).row, 19)
          msgbox(rg2.value)
      End if
  End Function
  </code></pre>
  
  <p>when executed find_range function,  I got </p>
  
  <blockquote>
    <p>variable is undefined "xlValues" "xlWhole" </p>
  </blockquote>
  
  <p>error. </p>
  
  <p>So I guess that I cannot just use excel built-in constants this way in VBScript.<br>
  So what is the correct way?</p>