title: VBScript 800a005e Error
body: <p>I'm using old VBScript in my ASP application. Trying to search and replace string using Replace(wholeText, textToSearch, textToReplace) function but i'm getting the following error:</p>
  
  <pre><code>Microsoft VBScript runtime  error '800a005e'
  
  Invalid use of Null: 'Replace'
  
  /instance/inst_spam_gen_4.asp, line 25 
  </code></pre>
  
  <p>And here is my function:</p>
  
  <pre><code>Function cleanUpText(txt)
  
          txt = Replace(txt, "“", """")
          txt = Replace(txt, "”", """")
          txt = Replace(txt, "’", "'")
          txt = Replace(txt, "®", "&amp;reg;")
  
      cleanUpText = txt
  End Function
  </code></pre>
  
  <p>How can I solve this problem?</p>
  
  <p>Thanks</p>