11-28-2011 10:25 AM
Hi Experts,
i am using OLE Automation to download some data into excel using 'EXCEL.APPLICATION' from SAP tables based on the requirement and the given format. I want to color a particular column in generated excel but cant do that. The data is getting downloaded correctly but cant set the color. Please can anyone suggest ?
Regards,
SURYA
11-28-2011 10:55 AM
Hi,
Can be something like this:
DATA: l_ole_interior TYPE ole2_object,
l_ole_cell1 TYPE ole2_object,
l_ole_cell2 TYPE ole2_object,
l_ole_range TYPE ole2_object.
CALL METHOD OF p_obj 'Cells' = l_ole_cell1
EXPORTING #1 = 1
#2 = 1.
IF sy-subrc EQ 0.
CALL METHOD OF p_obj 'Cells' = l_ole_cell2
EXPORTING #1 = 10
#2 = 1.
IF sy-subrc EQ 0.
CALL METHOD OF p_obj 'Range' = l_ole_range
EXPORTING #1 = l_ole_cell1
#2 = l_ole_cell2.
IF sy-subrc EQ 0.
CALL METHOD OF l_ole_range 'Interior' = l_ole_interior.
ENDIF.
ENDIF.
ENDIF.
SET PROPERTY OF l_ole_interior 'ColorIndex' = 33. "p_color.
SET PROPERTY OF l_ole_interior 'Pattern' = 1.
FREE OBJECT: l_ole_cell1, l_ole_cell2, l_ole_range, l_ole_interior.
Kr,
Manu.