Thread: Document Colors
View Single Post
  #6  
Old 24-05-2018, 04:05
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default delete color from palette

Code:
Sub DeleteColors()
Dim s As Shape, c As Color
    Set s = ActiveShape: If s Is Nothing Then Exit Sub
    If s.Fill.Type <> cdrUniformFill Then Exit Sub
    Set c = s.Fill.UniformColor
    s.Delete 'delete selected shape
    'looking for the same color
    For Each s In ActivePage.Shapes.All
        If s.Fill.Type = cdrUniformFill Then
            If c.IsSame(s.Fill.UniformColor) Then Exit Sub
        End If
    Next
    With ActiveDocument.Palette
        .RemoveColor .GetIndexOfColor(c)
    End With
End Sub
Reply With Quote