Bewerken

Delen via


ShapeRange.Id property (PowerPoint)

Returns a Long that identifies the shape or range of shapes. Read-only.

Syntax

expression. Id

expression A variable that represents a ShapeRange object.

Return value

Long

Example

This example adds a new shape to the active presentation, then fills the shape according to the value of the Id property.

Sub ShapeID()

    With ActivePresentation.Slides(1).Shapes.AddShape _
            (Type:=msoShape5pointStar, Left:=100, _
            Top:=100, Width:=100, Height:=100)

        Select Case .Id
            Case 0 To 500
                .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)

            Case 500 To 1000
                .Fill.ForeColor.RGB = RGB(Red:=255, Green:=255, Blue:=0)

            Case 1000 To 1500
                .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=255)

            Case 1500 To 2000
                .Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=0)

            Case 2000 To 2500
                .Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=255)

            Case Else
                .Fill.ForeColor.RGB = RGB(Red:=0, Green:=0, Blue:=255)
				
        End Select
    End With

End Sub

See also

ShapeRange Object

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.