MATLAB: How to set Tab color of an excel sheet using Matlab command

excelMATLABscript

I would like to color the spreadsheet tab into 'RED' or 'Green' using Matlab command.
Thanks in advance!!

Best Answer

The below command i used and it worked for me
% Excel = actxserver('excel.application');
WB = Excel.Workbooks.Open(fullfile('Sample.xls'));
% Set the color of Sheet 1 to RED
%'Red'--> give the proper color index ex: Red = 3
%'SheetNo'--> ex: Sheetno = 1
WB.Worksheets.Item(SheetNo).Tab.ColorIndex = Red;