Skip to Content

ABAP OLE Excel - choosing colors & creating borders


I am using OLE to create an Excel file, and I want to be able to set a background color of a cell. This is the code that I use to achieve this:

call method of cell_obj 'INTERIOR' = shading_obj.

set property of shading_obj 'ColorIndex' = color.

Color here is an integer from 1 to 56 that identifies some color available in Excel. I got all the color values from this link:

Is it possible to choose a color that is not among these 56 colors? Maybe a color identified by hex or some RGB value?

Also, how can I create a border around some range of cells in Excel file?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Dec 16, 2014 at 01:23 PM

    Actually, I figured it out myself. I should use this code instead:

    CALL METHOD OF lo_cell 'Interior' = lo_interior.
    SET PROPERTY OF lo_interior 'Color' = 15773696. "Hex color in decimal

    Using ole2 objects for create an excel file

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.