ExcelBuffer.SelectSheetsNameStream(NVInStream) throwing error

Hi Expert,

I am trying to upload data from excel file and written below code

DialogCaption := ‘Select File to upload’;
UploadResult := UploadIntoStream(DialogCaption, ‘’, ‘’, Name, NVInStream);

If Name <> ‘’ then
Sheetname := Rec_ExcelBuffer.SelectSheetsNameStream(NVInStream)
else
exit;

The bold highlighted one throw below error. Can any one let me know what wrong with this? This code was working fine earlier. I am kind of clueless any suggestion please
pastedimage1604067666840v1.png

1 Like

Hi, have you been able to solve the problem? I have the same problem

I have solved the problem if anyone else still has it.
The problem is not with the procedure call, but with the Record Excel Buffer. You have to declare this as temporary. Accordingly, the procedures must be adapted when passing parameters.
In my case, the function must be adapted when evaluating.
Ex:

 Evaluate(OrderNo, GetValueAtIndex(RowNo, 1)); call GetValueIndex from : local procedure GetValueAtIndex(RowNo: Integer; ColNo: Integer): Text
    var
        Rec_ExcelBuffer_Loc: Record "Excel Buffer";
    begin
        Rec_ExcelBuffer_Loc.Reset();
        If Rec_ExcelBuffer_Loc.Get(RowNo, ColNo) then
            exit(Rec_ExcelBuffer_Loc. "Cell Value as Text");
    end;

change to :

 local procedure GetValueAtIndex(RowNo: Integer; ColNo: Integer): Text
    var
    begin
        Rec_ExcelBuffer.Reset();
        If Rec_ExcelBuffer.Get(RowNo, ColNo) then
            exit(Rec_ExcelBuffer. "Cell Value as Text");
    end;
    var
        Rec_ExcelBuffer: Record "Excel Buffer" temporary;