Set Column width of Excel through Matlab

Hi, I tried to set the width of a column but i don't try..
i found a hint here:
and i simply call it (in another file which I open excel) with xlsAutoFitCol('myfile.xls','Sheet1','A:S'); but nothing change... that's what appears to me...
and what i want...
Someone can help me?

 Accepted Answer

Something like this.
ExcelApp=actxserver('excel.application');
ExcelApp.Visible=1;
NewWorkbook=ExcelApp.Workbooks.Open(ExcelFile);
NewSheet=NewWorkbook.Sheets.Item(1);
NewRange=NewSheet.Range('A1');
NewRange.ColumnWidth=40;

2 Comments

Vincenzo
Vincenzo on 21 Dec 2011
Moved: Rik on 30 Jun 2024
Great Fangjun!!
Music to my ears!!
Minor downside: this requires Windows and Excel.

Sign in to comment.

More Answers (0)

Categories

Asked:

on 21 Dec 2011

Moved:

Rik
on 30 Jun 2024

Community Treasure Hunt

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

Start Hunting!