Assuming the rich text field is named Body;
Set style = Session.CreateRichTextStyle
style.FontSize = 14
style.NotesColor = Color_Gray
Set item = doc.GetFirstItem(fnBody)
If item.Type = RICHTEXT Then
Set Body = doc.GetFirstItem(fnBody)
Set range = Body.CreateRange()
Call range.SetStyle(style)
Body.Compact
Body.Update
.
.
.
doc.Save
I use this code in the backend. Almost certainly it won't work in the UI without closing and reopening the doc.
To get any RBG color, use the NotesColorObject:
notesColor% = notesColorObject.SetRGB( red% , green% , blue% )