The code works for Word and Outlook but fails with PowerPoint in that only the first character or first word of the textbox ever gets selected. Is this a bug? Is there any workaround? Try this on a simple PowerPoint slide in PowerPoint 2013.

```
private static async Task<string> getText(double x, double y)
{
    string result = null;

    try
    {
        var location = new System.Windows.Point(x, y);
        AutomationElement element = AutomationElement.FromPoint(location);

        object patternObj;
        if (element.TryGetCurrentPattern(TextPattern.Pattern, out patternObj))
        {
            var textPattern = (TextPattern)patternObj;

            var range = textPattern.RangeFromPoint(location);
            range.ExpandToEnclosingUnit(TextUnit.Word);
            range.Select();

            var text = range.GetText(-1).TrimEnd('\r');
            return text.Trim();
        }
        else
        {
            return "no text found";
        }
    }
    catch (Exception ex)
    {
        return ex.Message;
    }
}

```

You cannot see it from the screenshot, but the mouse is on "first" not "stuck", but regardless of where the mouse is placed, it always is stuck. Maybe this is fixed in PowerPoint 2016?

[![enter image description here](https://i.stack.imgur.com/yCsoP.png)](https://i.stack.imgur.com/yCsoP.png)

When I look at the bounding box for the range it is always the whole element, rather than the selected word. That could be part of the problem of why RangeToPoint is not working.

Original posted in [MSDN](https://social.msdn.microsoft.com/Forums/en-US/2f5e5f4f-4d43-4c88-b865-9fc00af5b8c8/when-i-try-to-use-ui-automation-for-powerpoint-i-can-only-get-the-first-characterword-when-i-use?forum=appsforoffice) but no response...

**Update.** If I use 

```
text = printRange(range, text);
while (range.Move(TextUnit.Word, 1) > 0)
{
    text += Environment.NewLine;
    text = printRange(range, text);
}

```

I get

[![enter image description here](https://i.stack.imgur.com/kwNtZ.png)](https://i.stack.imgur.com/kwNtZ.png)