Report to excel problem

ROBOROBO Member Posts: 39
edited 2005-06-01 in Navision Attain
When I run a report that exports data to excel it stops at 999 lines.

Have anyone a solution
this is the code i use


CREATE(xlApp);

xlBook :=xlApp.Workbooks.Add(-4167);
xlSheet:=xlApp.ActiveSheet;
xlSheet.Name:='Mailing';

IF Contact.Name = '' THEN BEGIN ERROR('Geen relatienaam bekend.')END ELSE BEGIN

//Colom headers

xlSheet.Range('a1').Value := FORMAT('relatienummer');
xlSheet.Range('b1').Value := ('bedrijfsnaam');
xlSheet.Range('c1').Value := ('Adres');
xlSheet.Range('d1').Value := ('Postcode');
xlSheet.Range('e1').Value := ('Plaats');
xlSheet.Range('f1').Value := ('Postbusnummer');
xlSheet.Range('g1').Value := ('Postbus postcode');
xlSheet.Range('h1').Value := ('Postbus plaats');
xlSheet.Range('i1').Value := ('telefoonnummer');
xlSheet.Range('j1').Value := ('faxnummer');
//xlsheet.range('k1').value := ('telefoonnummer');
//xlsheet.range('l1').value := ('telefoonnummer');
//xlsheet.range('m1').value := ('telefoonnummer');
//xlsheet.range('n1').value := ('telefoonnummer');
//xlsheet.range('o1').value := ('telefoonnummer');
xlApp.Visible :=TRUE;

// variabele data
Number := 1;

IF Contact.FIND('-') THEN BEGIN

REPEAT

Number := Number +1;
nummer:=FORMAT(Number);
xlSheet.Range('a'+nummer).Value := Contact."No.";
xlSheet.Range('b'+nummer).Value := Contact."Company Name";
xlSheet.Range('c'+nummer).Value := Contact.Address;
xlSheet.Range('d'+nummer).Value := Contact."Post Code";
xlSheet.Range('e'+nummer).Value := Contact.City;
IF Contact.PostbusNummer <>'' THEN BEGIN
xlSheet.Range('f'+nummer).Value := 'Postbus '+Contact.PostbusNummer;
xlSheet.Range('g'+nummer).Value := Contact.PostbusPostcode;
xlSheet.Range('h'+nummer).Value := Contact.PostbusPlaats;
END ELSE BEGIN
END;
xlSheet.Range('i'+nummer).Value := Contact."Phone No.";
xlSheet.Range('j'+nummer).Value := Contact."Fax No.";
//xlsheet.range('k'+nummer).value := contact."no.";
//xlsheet.range('l'+nummer).value := contact."no.";
//xlsheet.range('m'+nummer).value := contact."no.";
//xlsheet.range('n'+nummer).value := contact."no.";
//xlsheet.range('o'+nummer).value := contact."no.";

UNTIL Contact.NEXT <=0;



END;
END

Comments

  • fbfb Member Posts: 246
    Ok, I'll guess: the problem is in this line:
    nummer:=FORMAT(Number);
    
    When "Number" is incremented to 1000, the FORMAT expression returns the string "1,000" (or perhaps "1.000" -- gotta remember the Intl stuff). Now, of course, Excel gets mad about the range expressions, which become "A1,000"/"A1.000".

    Solution: (Presuming that Number is an Integer...) Use 'standard format 2' in the format expression as follows:
    nummer := FORMAT(Number,0,2);
    
  • ROBOROBO Member Posts: 39
    ThanX FB it is working
Sign In or Register to comment.