PictureFormat.OriginalColorsInPalette property (Publisher)
Returns a Long that represents the number of colors in the specified linked picture's palette. Read-only.
expression A variable that represents a PictureFormat object.
This property only applies to linked pictures or OLE objects that are not TrueColor (that is, they contain color data of less than 24 bits per channel). Returns "Permission Denied" for shapes representing embedded or pasted pictures and OLE objects, or linked pictures that are TrueColor.
Use either of the following properties to determine whether a shape represents a linked picture:
Use the OriginalIsTrueColor property to determine whether a linked picture contains color data of 24 bits per channel or greater.
The following example returns a list of all pictures in the active publication that are not TrueColor. The number of colors in each picture's palette is returned, and if the picture is linked and the linked picture is not TrueColor, the number of colors in its palette is also returned.
Sub PictureColorInformation() Dim pgLoop As Page Dim shpLoop As Shape 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 If .IsTrueColor = msoFalse Then Debug.Print .Filename Debug.Print "This picture has " & .ColorsInPalette & " colors." If .IsLinked = msoTrue Then If .OriginalIsTrueColor = msoFalse Then Debug.Print "The linked picture has " & _ .OriginalColorsInPalette & " colors." End If End If End If End If End With End If Next shpLoop Next pgLoop End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.