I can cycle it on/off but can't figure out how to "reset" it. Once a color shape is deleted the doc palette still shows the color until you click thru and hit reset.
Sub RefreshDocPalette() ActiveDocument.Palette.Close
P.s. why after hitting "reset palette" does it add a black swatch even though there's no black used in the doc.
For i = ActiveDocument.Palette.Colors.Count To 1 Step -1 ActiveDocument.Palette.RemoveColor (i)Next i
that removes all colors. I just want to remove the color that's not used anywhere.
this one was offered to try but throws an error and still isn't right (see next post)
Sub RefreshDocPalette2()Dim c As Color, sr As New ShapeRange, srAllShapes As ShapeRange, s As Shape Set srAllShapes = ActivePage.Shapes.All For Each c In ActiveDocument.Palette.Colors For Each s In srAllShapes If s.Fill.Type = cdrUniformFill Then If c.IsSame(s.Fill.UniformColor) Then sr.Add s End If Next s If sr.Count > 0 Then srAllShapes.RemoveRange sr: sr.RemoveAll Else With ActiveDocument.Palette .RemoveColor .GetIndexOfColor(c) End With End If Next cEnd Sub
Sub ResetPalette(ByRef iDoc As Document)Dim CurColNo As Integer, CurPg As Page, CurSh As Shape, CurSR As ShapeRange, DoIt As BooleanFor CurColNo = iDoc.Palette.Colors.Count To 1 Step -1 DoIt = True For Each CurPg In iDoc.Pages Set CurSR = CurPg.Shapes.All If CurSR.Shapes.Count > 0 Then For Each CurSh In CurSR.Shapes If CurSh.Fill.Type = cdrUniformFill Then If CurSh.Fill.UniformColor.IsSame(iDoc.Palette.Colors(CurColNo)) Then DoIt = False End If Next CurSh End If Next CurPg If DoIt Then iDoc.Palette.RemoveColor CurColNoNext CurColNoEnd SubThis even check all pages