Color the cell in the excel


Is there any alternate way to color the cell in excel rather then using set range color. Actually while using the Set range color need to use the excel application scope and its giving the error message "call rejected by callee’.

So is there any alternate to do coloring the cell.



You can invoke the code to set color for cell like below.

Dim xlApp As Microsoft.Office.Interop.Excel._Application = Nothing
Dim xlWorkBooks As Microsoft.Office.Interop.Excel.Workbooks = Nothing
Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook = Nothing
Dim xlWorkSheet1 As Microsoft.Office.Interop.Excel.Worksheet = Nothing

xlWorkSheet1= CType(xlWorkSheets(1),Microsoft.Office.Interop.Excel.Worksheet)
xlWorkSheet1.Range(“A1:A2”).Interior.ColorIndex = 40

1 Like

Hi @Dany069
as for the error message, perhaps this thread will help you:

Otherwise, Set Range Color activity works for me when e.g. set up as shown below:

1 Like

its works for me but not all time. Sometime its work and sometime not so looking for alternate option like vba code and anything else. Thanks for the suggestion.

It is rather merely an interesting fact, which is not going to be as elegant as a vb code, but theoretically after you select your picked cells, you may apply the relevant Excel hotkey (if your Excel application scope is checked as “Visible”): “alt + h +h” to navigate to “Fill Color” menu with the palette, where you can go the the chosen color and then you confirm the color with "enter’.

Can you share any test flow, would be very helpful

Hi, check e.g. the attached one - just replace the file path to your own test sample.
color range.xaml (8.6 KB)

You may also pick some different color by navigation to the relevant field.

thanks for sharing the WF but still the main concern that you are using the excel application scope. While using that i’m getting the error. Attached screenshot FYR

You can try to set Delay(2000) before call

Hey Dany, I found the alternate, please check this demo: