Changing NumberFormat to DATE of an Excel Cell (Range) out of matlab with ActiveX

조회 수: 3 (최근 30일)
I am struggeling to change the cell attribute (to date) out of matlab via ActiveX.
WorkBook.Sheets.Add([], hExcel.ActiveSheet); % add a new sheet
row1 = {'Heading: ', [] , []}; % define top row with heading
row2 = {'Start Date: ', [], exceltime(Output_Struct.MetaData{1,4}.DateStart)};
row3 = {'End Dat: ', [], exceltime(Output_Struct.MetaData{1,4}.DateEnd)};
TableWithMetrics = [row1; row2; row3];
eActivesheetRange = get(hExcel.Activesheet,'Range',['A1:C', num2str(3)]); %
eActivesheetRange.Value = TableWithMetrics; % write the cell array into selected area in the active sheet
% formatting
top1row = hExcel.Activesheet.Range('A1');
set(top1row.Font, 'Size', 20); % apply formatting to the selected range
set(top1row.Font, 'Bold', true);
datecells = hExcel.Activesheet.Range('C2:C3');
% example out of the excel macro recorder : Selection.NumberFormat = "[$-407]d. mmmm yyyy;@"
set(datecells.NumberFormat, '[$-407]d. mmmm yyyy;@');
---> Result:
Error using set
Invalid handle
Error in createXlsReport (line 205)
set(datecells.NumberFormat, '"[$-407]d. mmmm yyyy;@"')
OK, then i try not to use set...
datecells.NumberFormat('[$-407]d. mmmm yyyy;@');
---> Result:
Index exceeds matrix dimensions.
Error in createXlsReport (line 207)
datecells.Numberformat('[$-407]d. mmmm yyyy;@');

답변 (0개)

카테고리

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

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by