ColorsInPalette Property
Returns a Long that represents the number of colors in the picture's palette. Read-only.
expression.ColorsInPalette()
expression Required. An expression that returns a PictureFormat object.
Remarks
This property only applies to pictures that are not TrueColor (that is, pictures that contain color data of less than 24 bits per channel.) Returns "Permission Denied" for shapes representing pictures that are TrueColor.
Use the IsTrueColor property of the PictureFormat object to determine whether a picture contains color data of 24 bits per channel or greater.
Example
The following example tests each picture in the active document, and prints out whether the picture is TrueColor, and if not, how many colors are in the picture's palette.
For Each pgLoop In ActiveDocument.Pages
For Each shpLoop In pgLoop.Shapes
If shpLoop.Type = pbLinkedPicture Or shpLoop.Type = pbPicture Then
With shpLoop.PictureFormat
If .IsEmpty = msoFalse Then
Debug.Print .Filename
If .IsTrueColor = msoTrue Then
Debug.Print "This picture is TrueColor"
Else
Debug.Print "This picture contains " & .ColorsInPalette & " colors."
End If
End If
End With
End If
Next shpLoop
Next pgLoop