I have a simple script that opens an excel file and copy the used range to cilpboard as image. It was working for at least 5 years. Now with the latest update from microsoft it is not longer working and throwing parameter error (-50). I have tried all combinations of optional parameters with appearance and screen. No matter what I try I always get this parameter error. Please suggest how can I change the parameters to make it working or confirm that it is not working for you too and hence a bug that should be reported to Microsoft. I have following code. The excel file is opened but then I get error -50 stating Parameter error. Parameter 'used range' is correct according to MS Excel dictionary documentation and the script works with Microsoft Excel 16.10.

    set filepath to "/Users/ayesha/Documents/ayesha/test.xlsx"  

    set scriptFilePath to POSIX file filepath

    tell application "Microsoft Excel"


        set myworkbook to open workbook workbook file name scriptFilePath

        copy picture used range of active sheet     

    end tell
  • And your question is what exactly? Also, please add any steps you‘ve already done to solve the problem (searching the web, Excel support sites etc)
    – nohillside
    Mar 17, 2018 at 11:32
  • Related (and problably even a duplicate) apple.stackexchange.com/questions/318087/…
    – nohillside
    Mar 17, 2018 at 11:34
  • I have edited my question, it is not a duplicate to the other question. It is a different applescript instruction that is not working. Please see if it now fits the rules.
    – zaini
    Mar 17, 2018 at 12:11
  • I have done a ton of research in last two days to solve the problem and have tried all parameter combinations available in documentation to solve this. I have even tried to reverse engineer MS Excel with MachOView in effort to see the correct parameters to this command. But I am not good at it. There is no path problem here either as the file is opened.
    – zaini
    Mar 17, 2018 at 12:15
  • Both questions are about storing parts of an Excel sheet into the clipboard as an image, so definitively this looks like the same problem (and the same solution)
    – nohillside
    Mar 17, 2018 at 12:39

1 Answer 1


Any script and file that you don't change and that works on Excel 16.10 (or Excel 15.41 from before the code base was changed / unified in version 16) and then breaks is a regression bug you should file with Microsoft. Version 16.10 has about 20 bugs we're taking with Microsoft and not all of them are fixed in Version 16.11 - some of the bugs are so bad that the ~/Library and container files become corrupt and the application itself will not even launch in Finder.

Full stop - file a bug with them after you have exhausted their support channels. Support is getting some pretty decent workarounds for some bugs, but version 15 to version 16 was a massive change so there clearly were (and today are still) tons of regressions.

In that bug you need to tell them (and us) what license you are using. The same excel program works differently based on how you license it. Features turn on and off so you don't have the same behavior based on licensing.

Now - I did try to dig into the Dictionary and see if I can find an error in your usage above, but your code is correct as the calls are documented. The problem is Excel - not your script.

I don't like loading older software - so the first thing I would do is try opening your file in Numbers and scripting there until the Excel version 16.xx works out all the kinks.

If you wanted to go back - here's the 15.41 installer - but you will need to consider cleaning everything potentially like Outlook identities, caches, preferences, etc... or installing this older Office on a new Mac OS or VM with a clean install or make a new user so you don't have old preferences that are from a newer version of the tool.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .