From: us on
"us "

one of the solutions
- note: this will create a file FOO.XLS with sheets 1:NS named 'MOD 01',...,'MOD 05',...
- afterwards: use XLSWRITE to address individual sheets...
- note: this version is processing silently...

% the data
fnam=[cd,filesep,'foo.xls']; % <- your file name...
ns=5; % <- #sheets in workbook...
ts='mod %2.2d'; % <- sheet name template...
% the engine
if exist(fnam,'file') % <- !!!!!
delete(fnam); % <- !!!!!
end
ex=actxserver('Excel.Application'); % <- ex.Visible=1; == verbous processing...
wb=ex.Workbooks.Add;
ws=wb.Sheets;
for i=ws.Count+1:ns
wb.Sheets.Add;
end
ws=wb.Sheets;
for i=1:ns
ws.Item(i).Name=sprintf(ts,i);
end
wb.SaveAs(fnam);
wb.Close;
ex.Quit;
delete(ex);
% the result
winopen(fnam);

us
From: Adam Chapman on
On Jun 29, 10:53 pm, "us " <u...(a)neurol.unizh.ch> wrote:
> "us "
>
> one of the solutions
> - note: this will create a file FOO.XLS with sheets 1:NS named 'MOD 01',....,'MOD 05',...
> - afterwards: use XLSWRITE to address individual sheets...
> - note: this version is processing silently...
>
> % the data
>      fnam=[cd,filesep,'foo.xls']; % <- your file name...
>      ns=5; % <- #sheets in workbook...
>      ts='mod %2.2d'; % <- sheet name template...
> % the engine
> if exist(fnam,'file') % <- !!!!!
>      delete(fnam); % <- !!!!!
> end
>      ex=actxserver('Excel.Application');     % <- ex.Visible=1; == verbous processing...
>      wb=ex.Workbooks.Add;
>      ws=wb.Sheets;
> for i=ws.Count+1:ns
>      wb.Sheets.Add;
> end
>      ws=wb.Sheets;
> for i=1:ns
>      ws.Item(i).Name=sprintf(ts,i);
> end
>      wb.SaveAs(fnam);
>      wb.Close;
>      ex.Quit;
>      delete(ex);
> % the result
>      winopen(fnam);
>
> us

Thanks us, very helpful. I was aware of the activex interface but was
a bit intimidated to use it. You really helped me get my head around
it.

Not sure if I have the commitment to code conditional formatting on
the spreadsheets, but is it possible through activex?
From: Andy on
> Not sure if I have the commitment to code conditional formatting on
> the spreadsheets, but is it possible through activex?

I'm not sure what you mean by "conditional formatting", but basically everything that you can do with Excel, you can do through actxserver.
From: Adam Chapman on
On Jun 30, 8:16 pm, "Andy " <theorigam...(a)gmail.com> wrote:
> > Not sure if I have the commitment to code conditional formatting on
> > the spreadsheets, but is it possible through activex?
>
> I'm not sure what you mean by "conditional formatting", but basically everything that you can do with Excel, you can do through actxserver.

I meant making a spreadsheet cell's background colour red when the
value it holds meets some condition, e.g. value<0