
If I understand you correctly, you want the array $b be available outside the UDF, right?
Then you just assign $b to the return variable which is the UDF name with a preceeding $-sign as explained in both the KiXtart Manual and the FAQ Forum.
Code:
FUNCTION READEXCEL($cfilename)
DIM $Rc,$Column,$Cell,$oXL,$a[300],$b[6,300]
;$a=1,2,3,4,5,6,7
;columns and order to be read
IF 0=EXIST($cfilename)
;insure the file exists
?'Excel file not found'
SLEEP 4
RETURN
;leave
ENDIF
$oXL=Createobject('Excel.application')
;Check to insure that Excel is available
IF 0<>@error
?@error ' Excel Application is not found'
SLEEP 4
RETURN
ENDIF
$Rc=$oXL.workbooks.open($cfilename)
For $Column=0 to 6
For $cell=0 to 300;ubound($a)
$b[$column,$cell]=$oXL.cells($column,$cell)
Next
Next
$oXL.quit
;quit Excel
$oXL=0
;set the object to 0
$ReadExcel=$b
ENDFUNCTION
BTW, to exit UDFs, one should use EXIT and the appropriate error code as illustated in the FAQ Forum and the UDF Guidelines.
It is also bad etiquette to rework an existing UDF to make it fit a specific case and not even rename the UDF. UDFs are supposed to be general-purpose functions with specifics provided through parameters.