The ColorCount property returns the number of colors in a color palette. The ColorCount property functions similarly to, but faster than, Colors.Count.
Examples:
The following VBA example displays the total number of colors found in the default palette.
Sub Test()
Dim pal As Palette
Set pal = ActivePalette
MsgBox "Default palette contains " & pal.ColorCount & " color(s)"
End Sub