Problem with ActiveX and Autofilter

조회 수: 2 (최근 30일)
Alexander Bartler
Alexander Bartler 2017년 3월 7일
답변: Ankita Nargundkar 2017년 3월 9일
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

답변 (1개)

Ankita Nargundkar
Ankita Nargundkar 2017년 3월 9일
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

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by