How to set types colors with Excel?

I tried using FamilyParameter.SetValue to read string/value to set the color of a type, but it didn’t work.

The warning said: The FamilyParameter.SetValue operation failed. The object reference is not set to an instance of an object.

Is it only possible to set colors by reading RGB values? Can materials set in Revit be directly selected and used by their names? Please give me some advice. Thank you very much.