Sub AddColor()
Dim pal As Palette
Set pal = ActivePalette
Dim c As New Color
Dim d As New Color
Dim R, G, B As Long
Dim Koler As String
Dim idx As Long
Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
Dim Co, n As Long
Co = OrigSelection.Shapes.Count
For n = 1 To Co Step 4
OrigSelection(n).CreateSelection
R = CorelScript.GetTextString
n = n + 1
OrigSelection(n).CreateSelection
G = CorelScript.GetTextString
n = n + 1
OrigSelection(n).CreateSelection
B = CorelScript.GetTextString
n = n + 1
OrigSelection(n).CreateSelection
Koler = CorelScript.GetTextString
c.RGBAssign R, G, B
pal.AddColor c
pal.Save
d.RGBAssign R, G, B
idx = ActivePalette.GetIndexOfColor(d)
ActivePalette.Colors(idx).SetName Koler
n = n - 3
Next n
pal.Save
End Sub