DocumentWindow.RangeFromPoint Method
Returns the Shape object that is located at the point specified by the screen position coordinate pair. If no shape is located at the coordinate pair specified, then the method returns Nothing.
Namespace: Microsoft.Office.Interop.PowerPoint
Assembly: Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)
Syntax
'Declaration
Function RangeFromPoint ( _
X As Integer, _
Y As Integer _
) As Object
'Usage
Dim instance As DocumentWindow
Dim X As Integer
Dim Y As Integer
Dim returnValue As Object
returnValue = instance.RangeFromPoint(X, _
Y)
Object RangeFromPoint(
int X,
int Y
)
Parameters
- X
Type: System.Int32
- Y
Type: System.Int32
Return Value
Type: System.Object
Examples
This example adds a new five-point star to slide one using the coordinates (288, 100). It then converts those coordinates from points to pixels, uses the RangeFromPoint method to return a reference to the new object, and changes the fill color of the star.
Dim myPointX As Integer, myPointY As Integer
Dim myShape As Object
ActivePresentation.Slides(1).Shapes _
.AddShape(msoShape5pointStar, 288, 100, 100, 72).Select
myPointX = ActiveWindow.PointsToScreenPixelsX(288)
myPointY = ActiveWindow.PointsToScreenPixelsY(100)
Set myShape = ActiveWindow.RangeFromPoint(myPointX, myPointY)
myShape.Fill.ForeColor.RGB = RGB(80, 160, 130)