Select multiple range using Matlab Activex Server
显示 更早的评论
I want to write the results of a data analysis with Matlab to an Excel spredsheet. To get it more handy and nice i also tried to format the content.
Because formating every single cell or range is very slow I tried to format a multiple range - but I didn't manage to get it running.
I recorded a macro directly with Excel that shows in principle, what i wanted to do:
Range("B355:AG359,B365:AG369").Select
Range("B365").Activate
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Color = -16776961
.TintAndShade = 0
.Weight = xlThin
End With
Now I tried to do it with Matlab ...
xls = actxserver('Excel.Application');
xlsDatei = xls.Workbooks.Open(xlsFileName);
myBook = xlsDatei.Sheets.Item(p);
myBook.Activate;
myRange = myBook.Range('B355:AG359,B365:AG369');
And this is the point - i always the following Matlab error:
Error using Interface.000208D8_0000_0000_C000_000000000046/Range
Error: Object returned error code: 0x800A03EC
Perhaps there who has done this before and can help me.
2 个评论
Walter Roberson
2019-4-16
The error code appears to signify a range that is invalid or does not exist in the spreadsheet. Or trying to access beyond row 65535 in an xls file.
Stefan
2019-4-16
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 ActiveX 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!