Hi,<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />
I have found an issue when using the Worksheet.Copy() method.
In some cases I was getting an Exception from that method:
“Exception is Item has already been added. Key in dictionary: '-1' Key being added: '-1'”
I have narrowed down the problem and have attached code and Workbooks that reproduce the issue.
I have found the cause of the error is when the Source Worksheet contains a custom function (from an Excel .xll add-in).
The issue only happens when the Source Worksheet is an Excel .xlsb file.
It does not happen with the same file saved as an Excel .xlsx file.
If you run the attached code against the attached .xlsb and .xlsx files you will be able to reproduce the error.
A fix would be greatly appreciated.
Many Thanks,
Mike