Free Support Forum -

Function IsColorInPalette doesn't work at all


I wanted to set the forecolor of a cell to a given color if that exists in the excel.Colors collection. First of all I recognized that the colors collection with version was totally empty. I tried it with version and the collection had 56 entries. Fine. But, trying to find any color within the collection with the mentioned function didn’t work. I tried Color.FromKnownColor, Color.FromArgb, Color.FromHtml. I had one match, I think it was color entry 54, and that only with the Color.FromHtml function. All the other ones didn’t result in a match.

After that i wrote my own IsColorInPalette function and compared the colors with equals. That didn’t work. I assured myself the colors were equal. A, R, G and B were totally equal. So in the end, I compared the A,R,G,B values of the instances to get a match.
I tried the same with the new Hotfix - same problem.

Any proposals or hints? Am I doing something wrong?
Thanks in advance

Michael Mann

Hi Michael,

Thanks for your feedback. It’s fixed in the latest hotfix . Please download it and have a try.

It works pretty fine - thanks for the quick response.