Hi again!!
As I thought, the situation is exactly the same…the error reply that comes back from the script is as follows:
tell application “Microsoft Excel”
set name of range “Dec10Table” to “Smith”
→ error number -1708
Result:
error “Microsoft Excel got an error: Can’t set name of range "Dec10Table" to "Smith".” number -10006 from name of range “Dec10Table”
However, the table changes it’s name as ordered in the script. It is very clear that the table is changing it’s name as ordered.
It has to be something to do with the new table styles???
Wait… I will just try something…
Yes - I have saved the original workbook with a template sheet “Template” without a name that I have defined (previously, I called the table range “TempTable”). In this situation, the new worksheet is created, the new table is created, and the script worked. So, the script seems to be only coming up with an error when the template table has been assigned a particular name.
This is not making a great deal of sense to me because when I examine the Excel document after running the script, it has defined two range names itself, “Table1” for the template table, and “Table13” for the newly created table. Therefore, I am left with two names for the same range when the script is finished?!?!
So, I guess I have success, but it seems to be success with confusion attached…
Is there a way to change the name of a defined range - perhaps this would completely resolve the situation???
Gradually moving forwards…
DDHawk
So, now, I am doing some experimentation to find out what is going on…I am running the following scipt