Search code examples
excelmacosapplescriptparallels

AppleScript Tell Application Microsoft Excel Opens Windows Excel on Mac with Parallels?


I am trying to use AppleScript to manipulate Mac Excel 2011 files on a Macbook Air running OSX Mavericks. I also have Parallels installed with Windows 8.1 and Windows Excel 2013.

When I run the following test script, it starts up Parallels, Windows 8.1 and Windows Excel 2013 instead of Mac Excel 2011. It doesn't even do this consistently - sometimes it will open Mac Excel 2011 after prompting for a file.

Here's the simple test script:

set theWorkbookFile to choose file with prompt "Please select an Excel   workbook file:"
set theWorkbookName to name of (info for theWorkbookFile)

tell application "Microsoft Excel"
    open theWorkbookFile

end tell

I tried replacing "Microsoft Excel" with "Mac Excel" but the compiler keeps changing it back.

Am I missing something simple here?


Solution

  • You can use the path of the application, like this :

    tell application "/Applications/Microsoft Office 2011/Microsoft Excel.app"
        open theWorkbookFile
    end tell