Error exporting to excel

RoddyMcLeanRoddyMcLean Member Posts: 101
edited 2006-04-21 in Navision Attain
I am getting an error using the Excel Buffer table to export: -

This message is for C/AL programmers
An exception occurred from an external component. The component did not provide the exception description.


Excel Table Buffer -
CreateSheet(SheetName,ReportHeader,CompanyName,UserID2)
REPEAT
RecNo := RecNo + 1;
Window.UPDATE(1,ROUND(RecNo / TotalRecNo * 10000,1));
IF NumberFormat <> '' THEN
XlWorkSheet.Range(xlColID + xlRowID).NumberFormat := NumberFormat;
IF Formula = '' THEN

It is failing on this line
XlWorkSheet.Range(xlColID + xlRowID).Value := "Cell Value as Text"

Any suggestions?

I have set up the data as follows: -
recExcelBuffer.xlRowID := 'A';
recExcelBuffer.xlColID := '1';
recExcelBuffer."Cell Value as Text" := '5';
recExcelBuffer.INSERT;


recExcelBuffer.CreateBook;
recExcelBuffer.CreateSheet('ROD','',COMPANYNAME,USERID);

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Have you tried to use the example provided in report 29 Export Acc. Sched. to Excel ?

    EnterCell(RowNo : Integer;ColumnNo : Integer;CellValue : Text[50];Bold : Boolean;Italic : Boolean;UnderLine : Boolean)
    TempExcelBuffer.INIT;
    TempExcelBuffer.VALIDATE("Row No.",RowNo);
    TempExcelBuffer.VALIDATE("Column No.",ColumnNo);
    TempExcelBuffer."Cell Value as Text" := CellValue;
    TempExcelBuffer.Formula := '';
    TempExcelBuffer.Bold := Bold;
    TempExcelBuffer.Italic := Italic;
    TempExcelBuffer.Underline := UnderLine;
    TempExcelBuffer.INSERT;
    
  • DenSterDenSter Member Posts: 8,307
    As far as I understand this (I'm new to this particular topic myself) you keep track of rows and columns with integer values, and the validation code of the Excel Buffer table will translate that into Excel values.
  • RoddyMcLeanRoddyMcLean Member Posts: 101
    Thanks guys, got this working
Sign In or Register to comment.