MATLAB: Am I unable to run an ActiveX method which has the same names as a function on the MATLAB path in MATLAB 7.4 (R2007a)

MATLAB

When I execute the following code:
Excel = actxserver('Excel.Application');
op = invoke(Excel.Workbooks, 'open', 'MyFile.xls');
Sheets = Excel.ActiveWorkBook.Sheets;
target_sheet = get(Sheets, 'item','Sheet1');
invoke(target_sheet, 'Activate');
Activesheet = Excel.Activesheet;
cellname = 'B2';
Range = Activesheet.cells.Range(cellname,cellname);
I receive the following error:
??? Error using ==> range
Too many input arguments.
Error in ==> MyScript at 8
Range = Activesheet.cells.Range(cellname,cellname);
This error does not occur in MATLAB releases prior to R2007a.

Best Answer

There has been a change in the way MATLAB handles ActiveX methods with the same name as that of a class. Beginning in MATLAB R2007a, an ActiveX method with the same name as a class will be treated as a constructor and cannot be called in the same way as an ordinary method.
In this particular example Range is a constructor of the class Range and is thus ignored. The function RANGE on the MATLAB path is called instead.
To work around this behavior, use the following alternative syntax to call your ActiveX method:
Range = get(Activesheet.cells, 'Range', cellname, cellname);