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 Center および File ExchangeActiveX についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by