How to convert from System.Drawing.Color to Excel.ColorFormat in C#? Change comment color

I'm developing a vsto addin for Excel, and I'm trying to change the color to the comments in Excel.

This is the code that I have:

Excel.Range activeCell = _application.ActiveCell; activeCell.AddComment("some text")); activeCell.Comment.Shape.Fill.BackColor = Color.Red;

The exception I'm getting is:

Cannot implicitly convert type 'System.Drawing.Color' to 'Microsoft.Office.Interop.Excel.ColorFormat'

I cannot find how to make a conversion between the two formats.

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/KDIeC.png" alt="enter image description here">


One option is to use ColorTranslator.ToOle

int oleColor = ColorTranslator.ToOle(Color.Red); activeCell.Comment.Shape.Fill.BackColor.RGB = oleColor;


Try this:

activeCell.Comment.Shape.Fill.BackColor = XlRgbColor.rgbRed;

Or this(EDIT: False):

activeCell.Comment.Shape.Fill.BackColor.RGB = Color.FromRgb(255,0,0);


  • Catch Ctrl+Enter when user typing text in Ext.form.field.HtmlEditor
  • Make another controllers view a partial (Rails 3)
  • Running a single macro on several Cells
  • VBA - syntax for .pictures.insert incorrect? Insert method of picture class failed
  • Excel - Macro to create chart based on selection
  • Can I get a MouseOver event to show small dialog box for an item in the ListViewControl?
  • Implementing search&highlight - how can I avoid delays when highlight is slow?
  • Creating an array variable with a variable number of elements
  • How objects are created when the prototype of their constructor isn't an object?
  • carrierwave Excon::Errors::SocketError
  • Check if windows explorer already opened on given path
  • module vs type behavior difference on using F# lambda as actual argument to formal parameter that ex
  • Passing data from partial view inside a modal to the main view and then close the modal
  • Base64 as method of sanitizing user input for Mysql
  • Cythonized function unexpectedly slow
  • How to reshape a 3D numpy array?
  • How to change placeholder text in an autocomplete activity of android google place?
  • How to create a Unix-domain socket with specific access permissions
  • JSON encode and decode on PHP
  • jQuery: add elements until a particular height is reached
  • How to modify the colors in the legend of a plot using a fill gradient?
  • Custom Tabgroup Appcelerator
  • $wpdb not working in file of WordPress plugin
  • Highlight and Bold text in JTextPane
  • Xamarin Forms - UWP Fonts
  • Retrieving value from sql ExecuteScalar()
  • javascript inside java/jsp code
  • MySQL WHERE-condition in procedure ignored
  • How to show dropdown in excel using jrxml (jasper api)?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Web-crawler for facebook in python
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Arrays break string types in Julia
  • Matrix multiplication with MKL
  • Android Studio and gradle
  • trying to dynamically update Highchart column chart but series undefined
  • Android Google Maps API OnLocationChanged only called once
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can i traverse a binary tree from right to left in java?
  • java string with new operator and a literal