ExcelApplication - Bold

Hi,
How to implement bold , color for particular excel range.
Thanks in advance.

Here is code from my Xojo Excel 2019 book which adds four words to cells A1, A2, A3, and A4. A range of cells from A1 to A2 have the font bolded, and the colour changed to green.

Sub Pressed() Handles Pressed
  Var excel As New ExcelApplication
  excel.workbooks.add
  excel.visible = True
  
  excel.Range("A1").Value = "Hello"
  excel.Range("A2").Value = "World"
  excel.Range("A3").Value = "with"
  excel.Range("A4").Value = "colour"
  
  excel.Range("A1:A2").Font.Bold = True //Bold
  excel.Range("A1:A2").Font.Color_ = 65280 //Green
End Sub

Here is a screen grab of the final running program in Excel 2019

ExcelBoldColour

1 Like