Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: xlswrite to Excel 2007 problem
Date: Fri, 5 Sep 2008 01:46:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <g9q30q$20c$1@fred.mathworks.com>
References: <g9p9j3$a8b$1@fred.mathworks.com> <3194495.1220562582966.JavaMail.jakarta@nitrogen.mathforum.org> <g9pp3u$md5$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1220579162 2060 172.30.248.38 (5 Sep 2008 01:46:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Sep 2008 01:46:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1431729
Xref: news.mathworks.com comp.soft-sys.matlab:488681



You have to initialize the Workbook and Worksheet

function ExcelFn
exl = actxserver('excel.application');
exlWkbk = exl.Workbooks;
exlFile = exlWkbk.Open
(['C:\folder\file']);
exlSheet1 = exlFile.Sheets.Item('Sheet1');
input=exlSheet1.Range('B3');

...Matlab formulas...

exlSheet1.Range('C3')=output;
exlWkbk.Close
exl.Quit
end