{NeoBook Function}
Version=5,70
Language=VBScript
Param=[%1]|Text|Excel file path
Param=[%2]|Text|Sheet name in the file
Param=[%3]|Text|Initial address of the cell range
Param=[%4]|Text|End address of the cell range
{End}
On Error Resume Next
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("[%1]")
objExcel.DisplayAlerts = False
objWorkbook.Sheets("[%2]").Select

RangeR = "[%3]" : RangeC = "[%4]"
arrRows = Split(RangeR,",") : arrCols = Split(RangeC,",")

reDim Preserve arrRows(3), arrCols(3)
arrRows(2)=arrRows(1) : arrRows(1)=arrRows(0)
arrCols(2)=arrCols(1) : arrCols(1)=arrCols(0)

For Row = arrRows(1) to arrRows(2)
 For Col = arrCols(1) to arrCols(2)
  nbSetVar "[XLNB"&Row&"_"&Col&"]", objExcel.Cells(Row, Col).Value
 Next
Next

nbSetVar "[XLNB]", Err.Number
objWorkbook.Saved = True
objWorkbook.Close False
objExcel.Quit

Set objWorkbook = Nothing
Set objExcel = Nothing
