title: HTA and Find Function Excel VBA
body: <pre><code>Sub search       
  Set objExl = CreateObject("Excel.Application")
  Set objWb = objExl.Workbooks
  objWb.Open("C:\Documents and Settings\user\Desktop\book.xls")
  Set strbol = objWb("C:\Documents and Settings\user\Desktop\book.xls").Sheets(1).Cells.Find(document.getElementById("q").Value, Range("A1"), xlValues, xlPart, xlByRows, xlNext, False, False)
  Set objDiv = document.getElementById("content")
  objDiv.innerText = "Result: " &amp; objWb.Sheets(1).Cells(strbol.Row,strbol.Column).Offset(0,-4).Value      
  objWb("C:\Documents and Settings\user\Desktop\book.xls").Close
  Set objWb = Nothing
  Set objExl  = Nothing
  End Sub
  </code></pre>
  
  <p>Above is HTA code which gets query word from HTA textbox, finds that word in excel, and returns/displays resulting offset row value in content named div. 
  I can run script successfully till opening of excel file.
  But script gives error at line : Set strbol . . .
  Error message : Subscript out of range.</p>
  
  <p>I tested find method in excel vba it worked their, but not in HTA
  note: posting from IE6, so pardon for indents and formatting error.</p>