Format Excel Worksheet of workbook in MSD axapta

This is code hints to Format Excel Worksheet of workbook in axapta. You excel workbook will be in xls or in higher version. You can open excel sheet by using visible true property then you can use other properties like font,style etc    

 #Excel  
    SysExcelApplication     excelApp;  
    SysExcelWorkbooks      XLSWorkbooks;  
    SysExcelWorkbook      XLSWorkbook;  
    SysExcelWorksheet      sheet;  
    SysExcelRange        range;  
    SysExcelStyles       styles;  
    SysExcelStyle        style;  
    SysExcelInterior      interior;  
    SysExcelFont        font;  
    COM             _char, RangeComObj;  
    ;  
    excelApp    = SysExcelApplication::construct();  
    excelApp.visible(true);  
    XLSWorkbooks    = excelApp.workbooks();  
    XLSWorkbook    = XLSWorkbooks.add();  
    sheet    = excelApp.activeSheet();  
    range    = sheet.range('A1');  
    styles   = XLSWorkbook.styles();  
    style    = styles.add('MyStyle');  
    interior  = style.interior();  
    interior.color(WinApi::RGB2int(246, 233, 206));  
    font    = style.font();  
    font.bold(true);  
    font.color(winapi::RGB2int(153, 204, 255));  
    range.style('MyStyle');  
    range.locked(true);  
    RangeComObj     = range.comObject();  
    _char    = RangeComObj.characters(1);  
    _char.insert('MyStyle');