Setting color properties with VBA is a complex enterprise. IF you want to use the # notation, you have to convert it first to a decimal number. Here's a function to do that:
Code:
Public Function fcnHexColToRGB(ByVal hexColor As String) As String
On Error GoTo fcnHexColToRGB_Error
'Example HexColor = "#00FF1F"
Dim Red As String
Dim Green As String
Dim Blue As String
hexColor = Replace(hexColor, "#", "")
Red = Val("&H" & Mid(hexColor, 1, 2))
Green = Val("&H" & Mid(hexColor, 3, 2))
Blue = Val("&H" & Mid(hexColor, 5, 2))
fcnHexColToRGB = RGB(Red, Green, Blue)
'The output is an RGB value
On Error GoTo 0
Exit Function
fcnHexColToRGB_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure fcnHexColToRGB"
End Function
If you plug in your value "#BFBFBF", you will get 12566463.
So the working code would be
Code:
Else
[Notes History].BackColor = 12566463