IsGreyScale Property

Microsoft Publisher Visual Basic

Show All Show All

IsGreyScale Property

Returns a MsoTriState constant that indicates whether the picture is a greyscale image. Read-only.

MsoTriState can be one of these MsoTriState constants.
msoCTrue Not used with this property.
msoFalse The picture is not a greyscale image.
msoTriStateMixed Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle Not used with this property.
msoTrue The specified picture is a greyscale image.

expression.IsGreyScale()

expression    Required. An expression that returns a PictureFormat object.

Example

The following example returns a list of the greyscale pictures contained in the active publication.

    Sub ListGreyScalePictures()
Dim pgLoop As Page
Dim shpLoop As Shape

    For Each pgLoop In ActiveDocument.Pages
        For Each shpLoop In pgLoop.Shapes
    
            If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then
            
                With shpLoop.PictureFormat
                    If .IsEmpty = msoFalse And .IsGreyScale = msoCTrue Then
                        
                        Debug.Print .Filename
                        Debug.Print "Page " & pgLoop.PageNumber
                        
                    End If
                End With
            
            End If
        
        Next shpLoop
    Next pgLoop

End Sub