Search code examples
applescript

How to get selected text in Word 2011 within Applescript


I want to get the selected text in the active document in Word 2011 from Apple-Script.

Thanks


Solution

  • I've tried this, and it works

        tell application "Microsoft Word"
            activate
            try
                set selectedText to content of text object of selection
                display dialog selectedText buttons {"OK"}
            on error
                display dialog "erreur" buttons {"OK"}
            end try
        end tell