Select multiple range using Matlab Activex Server
Show older comments
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 Comments
Walter Roberson
on 16 Apr 2019
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
on 16 Apr 2019
Answers (0)
Categories
Find more on ActiveX in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!