Find whole words in excel

I am trying to locate a column name in excel and i am using the “find”
method. But it seems to be doing a partial match (instead of whole word
match).
I have two columns in my excel “ParentOrgId” and “OrgId” , when i search
for “OrgId” it returns the “ParentOrgId” . How can i make it do a whole
word match so that it returns “OrgId”.

The snippet of code used is given below

equire ‘win32ole’

excel = WIN32OLE.connect(“excel.application”)
excel.visible = TRUE
wbook=excel.Workbooks.open(“D:/test.xls”)
wsheet=wbook.Worksheets(“OrgInfo”)
rFoundCell = wsheet.Range(“A1:IV1”).Find(‘OrgId’)
puts rFoundCell.value

the .find method signature has more then one parameter (all optional).
Look at this url for some example: Excel Automation - Ron de Bruin

A snippet:

With Sheets(“Sheet1”).Range(“A:A”)
Set Rng = .Find(What:=FindString, _
After:=.Cells(1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)

Though it’s too late for the reply, It could help others in future:
With reference to Ruby on Windows: excel

Loading the Win32OLE Constants section, I could work this out as
follows:

class XLConst
end

WIN32OLE.const_load(excel, XLConst)
rFoundCell = wsheet.Range(“A1:IV1”).Find(‘OrgId’,
‘LookAt’=>XLConst::XlWhole)

Hope this helps, Cheers!