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
ActiveDocument.Palette.Open
End Sub
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.
Can you provide some more information?
Did you got an error? If Yes: Which message?
I only see a picture with the code and the debugger on. This is a little less to understand the problem!
I asked before if you were calling NudeFan's sub for the active document, and I gave an example of a little sub to do exactly that.
Here's my sub and the sub from NudeFan that it uses.
Sub reset_docpalette() ResetPalette ActiveDocument End Sub Sub ResetPalette(ByRef iDoc As Document) Dim CurColNo As Integer, CurPg As Page, CurSh As Shape, CurSR As ShapeRange, DoIt As Boolean For 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 CurColNo Next CurColNo End Sub
Played around with it abit
found by adding these to the code gets me closer but doesn't work well with Pantone colors.
Tried your code too Eskino but same thing. Works as long as the colors aren't pantones
Oops, Eskino is your cousin. Sorry about that I'm just back from a rather strange medical procedure and I guess I'm still a little loopy