Thread Subject: problem with xlswrite1

Subject: problem with xlswrite1

From: Isaac

Date: 2 Nov, 2009 12:24:02

Message: 1 of 3

i tried to use xlswrite1 instead of xlswrite and, as i call it from some functions of mine and not from the command line, i changed, as suggested, the first line in

Excel = evalin('caller', 'Excel');

but it gives me the following error:

??? Undefined function or variable 'Excel'.

how can i fix it? :)

thanks

Subject: problem with xlswrite1

From: ImageAnalyst

Date: 2 Nov, 2009 14:02:24

Message: 2 of 3

Are you sure you have Excel installed?
If so, here is the code I use to startup excel, use xlswrite1(), and
shutdown Excel:

%----- Open Excel for writing.
Excel = actxserver('Excel.Application');
if ~exist(excelFileName, 'file')
ExcelWorkbook = Excel.workbooks.Add;
ExcelWorkbook.SaveAs(excelFileName, 1);
ExcelWorkbook.Close(false);
end
Excel.Visible = true; % Make Excel visible.
% Open up workbook.
invoke(Excel.Workbooks, 'Open', excelFileName);
% Save the reference to this workbook so that we can later activate
it, in case we open multiple workbooks.
%wbNumber1 = Excel.ActiveWorkbook;

% Do the actual writing of the data to the open worksheet.
xlswrite1(excelFileName, dataArray, 'MySheetname', 'C3');

invoke(Excel.ActiveWorkbook,'Save'); % Save to disk.

% Shut down Excel.
Excel.Quit
Excel.delete
clear Excel; % Remove variable from workspace.
Good luck,
ImageAnalyst

Subject: problem with xlswrite1

From: Isaac

Date: 3 Nov, 2009 10:18:03

Message: 3 of 3

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <dd23afb5-e324-4eb4-bbf8-e9f72ab20b30@m38g2000yqd.googlegroups.com>...
> Are you sure you have Excel installed?
> If so, here is the code I use to startup excel, use xlswrite1(), and
> shutdown Excel:
>
> %----- Open Excel for writing.
> Excel = actxserver('Excel.Application');
> if ~exist(excelFileName, 'file')
> ExcelWorkbook = Excel.workbooks.Add;
> ExcelWorkbook.SaveAs(excelFileName, 1);
> ExcelWorkbook.Close(false);
> end
> Excel.Visible = true; % Make Excel visible.
> % Open up workbook.
> invoke(Excel.Workbooks, 'Open', excelFileName);
> % Save the reference to this workbook so that we can later activate
> it, in case we open multiple workbooks.
> %wbNumber1 = Excel.ActiveWorkbook;
>
> % Do the actual writing of the data to the open worksheet.
> xlswrite1(excelFileName, dataArray, 'MySheetname', 'C3');
>
> invoke(Excel.ActiveWorkbook,'Save'); % Save to disk.
>
> % Shut down Excel.
> Excel.Quit
> Excel.delete
> clear Excel; % Remove variable from workspace.
> Good luck,
> ImageAnalyst

hi Image :)
yes i have excel installed...
but also the instruction Excel = actxserver('Excel.Application'); gives me error :(((

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com