title: Why is the code to change the color of a cell in vb.net different from vba?
body: <p>This may sound dumb but can someone explain the reason why I need to include this extra code in vb.net that I don't need in VBA when changing the color of a cell.
  I wrote a program that creates and saves an excel file using the microsoft.office.interop reference. Here is my code:</p>
  
  <pre><code>Public Class Export_Excel_Class
  Public excelapp As Microsoft.Office.Interop.Excel.Application
  Public excelbook As Microsoft.Office.Interop.Excel.Workbook
  Public excelsheet As Microsoft.Office.Interop.Excel.Worksheet
  
  Public Sub newExcel()
  
      excelapp = New Microsoft.Office.Interop.Excel.Application
      excelbook = excelapp.Workbooks.Add()
      excelsheet = excelbook.Sheets("sheet1")
      excelsheet.Range("A1").Select()
      excelsheet.Range("a1").AddComment("hello")
      excelsheet.Range("a1:B10").Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Yellow)
      excelbook.SaveAs("C:\Users\DatOneBull\Desktop\Excel_Test")
      excelapp.Quit()
  
  End Sub
  </code></pre>
  
  <p>On the line that sets the color I had originally had tried     <code>excelsheet.Range("a1:B10").Interior.Color =</code> 
  and tried to set a color but the color proptery is read only. I found the solution online but there was no explanation. Can someone tell me what this section of code means and why it is able to set the color value of th range?</p>
  
  <pre><code>System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Yellow)
  </code></pre>