Excel Automation - Format Cell

slowhandfanslowhandfan Member Posts: 56
I have several reports that create EXCEL workbooks.

Usually numeric fields are dollar fields, and I give EXCEL a decimal field using this command

xlSheet.Range(Cell).Value := item2."COGS (LCY)";

and it is automatically formatted with a $ and two decimals

The bad news is, he is also formatting this as currency

xlSheet.Range(Cell).Value := item2."Sales (Qty.)";

when I want this field to have no decimal places and no $


Anyone know how to do this?

Thanks Scott Wilson AKA SLOWHANDFAN

Comments

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from Navision Tips & Tricks forum to Navision forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • JackalJackal Member Posts: 3
    xlSheet.Range(Cell).NumberFormat = X

    If x = '@', it will be TEXT
    If x = '#,##0.00' it will bedecimal
    If x = '0' it will be Integer
Sign In or Register to comment.