IsTrueColor Property

Microsoft Publisher Visual Basic

Show All Show All

IsTrueColor Property

Returns an MsoTriState constant indicating whether the specified picture or OLE object contains color data of 24 bits per channel or greater. Read-only.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this property.
msoFalse The specified picture does not contain color data of 24 bits per channel or greater.
msoTriStateMixed Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle Not used with this property.
msoTrue The specified picture contains color data of 24 bits per channel or greater.

expression.IsTrueColor()

expression    Required. An expression that returns a PictureFormat object.

Remarks

For pictures that are not TrueColor, use the ColorsInPalette property of the PictureFormat object to determine the number of colors in the picture's palette.

Example

The following example tests each picture in the active document and prints out whether the picture is TrueColor, and if not prints 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