Word/Excel Vba vlookup "Subscript out of range" error
<p>I'm trying to use vlookup to read a string from a word document and return corresponding values from an excel sheet. I seem to be getting a "Subscript out or Range" Error on the vlookup function.</p>

<p>This is the worksheet that i am looking at:
<a href="http://i.stack.imgur.com/uPgMZ.png" rel="nofollow">Sample Data</a></p>

<p>The code I have is:</p>

<pre><code>Sub Autofill()
Dim oExcel As New Excel.Application
Dim testdb As Excel.Workbook
Dim testvar1 As Double

Set testdb = oExcel.Workbooks.Open("k:\SIF\Vibration\Dbase.xlsm")

testvar1 = oExcel.WorksheetFunction.VLookup("Roger", testdb.Sheets("Main").Range("A1:C4"), 2, False)

MsgBox (testvar1)

End Sub
</code></pre>

<p>I tried using the Application.Vlookup function as well, to no avail. Got the same error.</p>