the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > you can use the following code for Excel cell color value:
Dim style1 As Excel.Style
Dim style2 As Excel.Style
Dim color1 As Integer
Dim color2 As Integer
' 打开Excel文件
AppXls = New Microsoft.Office.Interop.Excel.Application
AppXls.Workbooks.Open(FileName)
AppXls.Visible = False
AppWokBook = AppXls.Workbooks(1)
AppSheet = AppWokBook.Sheets(1)
' 获取单元格样式和颜色
style1 = AppSheet.Cells(2, 1).Style
style2 = AppSheet.Cells(2, 2).Style
color1 = style1.Interior.Color
color2 = style2.Interior.Color
' 将颜色值转换成RGB值
Dim r1 As Integer = color1 Mod 256
Dim g1 As Integer = color1 \ 256 Mod 256
Dim b1 As Integer = color1 \ 256 \ 256 Mod 256
Dim r2 As Integer = color2 Mod 256
Dim g2 As Integer = color2 \ 256 Mod 256
Dim b2 As Integer = color2 \ 256 \ 256 Mod 256
' 显示颜色值
Label2.Text = "RGB(" & r1 & ", " & g1 & ", " & b1 & ")"
Label3.Text = "RGB(" & r2 & ", " & g2 & ", " & b2 & ")"
' 关闭Excel文件
AppXls.Quit()
AppWokBook = Nothing
AppSheet = Nothing
AppXls = Nothing
Where, style1.Interior.Color and style2.Interior.Color can obtain the color value of the cell, but this value is the color index value of Excel, which needs to be converted to RGB value to get the specific color.