Changing NumberFormat to DATE of an Excel Cell (Range) out of matlab with ActiveX
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur ActiveX dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!