Problem with ActiveX and Autofilter

2 visualizaciones (últimos 30 días)
Alexander Bartler
Alexander Bartler el 7 de Mzo. de 2017
Respondida: Ankita Nargundkar el 9 de Mzo. de 2017
Hello, I'm currently trying to generate an Excel-file with an autofilter. Therefore I'm using the following code.
%Open ActiveX
e = actxserver('Excel.Application');
ewb = e.Workbooks.Open(fullFileNameSave);
sheetNumber = 1;
...
...
%Selecting worksheet and apply freezePanes
nS=ewb.WorkSheets.Item(sheetNumber);
nS.Activate();
nS.Application.ActiveWindow.SplitRow = 1;
nS.Application.ActiveWindow.FreezePanes = true;
%AutoFilter
nR = nS.Range('A1:D1');
nR.Select;
nR.AutoFilter;
...
...
ewb.Save
ewb.Close;
e.Quit;
delete(e);
The code is running without any errors. But when I'm trying to apply a sorting rule in this Excel file Excel is hanging-up and I have to kill the process.
Thanks for your help.
Kind regards, Alex

Respuestas (1)

Ankita Nargundkar
Ankita Nargundkar el 9 de Mzo. de 2017
1. Since the excel file is generated successfully it may be that the issue is not with MATLAB but with Excel sheet. Check if your version of Excel you have is supported by MATLAB
2. Try the sample example from this link and use Autofilter ans apply sorting rule on the excel file that is generated. See if you get similar issue
3. You may also contact MathWorks technical support if you strongly feel that the issue from the MATLAB's side

Community Treasure Hunt

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

Start Hunting!

Translated by