MATLAB: How to set the letters in an Excel sheet cell to ‘BOLD’ through ACTXSERVER using MATLAB 7.8 (R2009a)

MATLAB

I wish to make the word "align" bold in an Excel worksheet cell.

Best Answer

The ability to connect to applications that allow standard COM/ActiveX invocation via the MATLAB COM Client interface is supported in MATLAB 7.8 (R2009a).
However, since each application can have a different set of API methods, we usually are not able provide extended technical support for usage and syntax of each application's specific API.
In this specific case, Excel is the application invoked as a COM server via the COM Client interface from MATLAB. To make the lettes of a cell 'BOLD', one can use the following MATLAB code snippet:
h = actxserver('Excel.Application')
h.visible = true
h.Workbooks.Add
sheet = h.ActiveWorkbook.Sheets.Item(1);
sheet.Activate
cells = h.ActiveSheet.Range('C1')
set(cells.Font, 'Bold', true)
Letters typed in cell 'C1' will appear bold now.