Code: Select all
; Constants
xlValues := -4163
xlWhole := 1
; Remove spaces, tabs, carriage returns, and linefeeds from either end of the clipboard.
Claim := Trim(Clipboard, A_Space A_Tab "`r`n")
XL := ComObjCreate("Excel.Application")
XL.Workbooks.Open("C:\Users\James\Desktop\Conversion.xlsx") ;open an existing file
XL.Visible := True
; It's possible to specify more options for find. See https://msdn.microsoft.com/en-us/library/office/ff839746.aspx
; Also for the Find methods: LookIn, LookAt, SearchOrder, and MatchByte are saved each time you use it. From the docs:
; "To avoid problems, set these arguments explicitly each time you use this method."
; Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
MyCell := XL.Sheets(1).Range("A:A").Find(Claim,, xlValues, xlWhole) ; Find the claim number
if (MyCell)
{
Clipboard := MyCell.Offset(0, 1).Text
}
XL.Quit()
return
Untested, but try something like this.
Use the Excel object browser to search for the values of constants (like xlWhole ).
HTH