Undefined function or variable 'Sheets'.

Hello! I'm using this code to get formulas from excel sheet:
excel = actxserver('Excel.Application');
excel.DisplayAlerts = false;
ibsex = excel.Workbooks.Open(filename);
pause(5)
ibssheet = ibsex.Sheets.Item('DATA');
line = strcat('B',num2str(today_row+1),':FP',num2str(today_row+1));
formulas = ibssheet.Range(line).Formula;
ibsex.Close
pause(5)
excel.Quit
pause(5)
the problem is that i recive the error "Undefined function or variable 'Sheets'" when Matlab is executing the line:
ibssheet = ibsex.Sheets.Item('DATA');
How Can I fix the problem? many thanks!

7 commentaires

Walter Roberson
Walter Roberson le 9 Mai 2017
What happens if the Open fails?
Adriano
Adriano le 9 Mai 2017
Modifié(e) : Adriano le 9 Mai 2017
The Open never fails. The Item code fails. Sometimes I recive also this error:
Undefined function 'Item' for input arguments of type 'Interface.000208D7_0000_0000_C000_000000000046'.
dpb
dpb le 9 Mai 2017
I "know nuthink!" about Excel macro language syntax, but is 'DATA' extant or correct argument? Should single be double quotes?
Just throwing out stuff...
Jan
Jan le 9 Mai 2017
Dear dpb, I need some time to understand terms like "know nuthink!"
Guillaume
Guillaume le 9 Mai 2017
Modifié(e) : Guillaume le 9 Mai 2017
I would recommend commenting out the DisplayAlerts = false in case excel actually shows an alert and instead having
%excel.DisplayAlerts = false; %leave on for debugging
excel.Visible = true;
Does anything pop up in excel?
Adriano
Adriano le 20 Fév 2018
Excel doesn't open any pop up but the problem persist.
I have found this problem. Do you have the solution

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by