Table of contents
TOC
Collapse the table of content
Expand the table of content

PictureFormat.OriginalColorsInPalette Property (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Returns a Long that represents the number of colors in the specified linked picture's palette. Read-only.

Syntax

expression. OriginalColorsInPalette

_expression_A variable that represents an PictureFormat object.

Return Value

Long

Remarks

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.

Example

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
© 2018 Microsoft