choose Excel Com Server Version

5 Ansichten (letzte 30 Tage)
Martin1986
Martin1986 am 26 Jan. 2012
I try to choose which excel version should create the output i have installed both 2003 and 2007 i check with regedit # HKEY_CLASSES_ROOT\Excel.Application # HKEY_CLASSES_ROOT\Excel.Application.11 # HKEY_CLASSES_ROOT\Excel.Application.12
switch typ
case 1
[file,path] = uiputfile('*.xls','Save selected data');
Excel = actxserver('Excel.Application.11');
case 2
[file,path] = uiputfile('*.xlsx','Save selected data');
Excel = actxserver('Excel.Application.12');
otherwise
return;
end fileName=fullfile(path,file);
if ~exist(fileName,'file')
ExcelWorkbook = Excel.workbooks.Add;
ExcelWorkbook.SaveAs(fileName)
ExcelWorkbook.Close(false);
end
ExcelWorkbook = Excel.workbooks.Open(fileName);
for case 1 it works fine case 2 not
??? Invoke Error, Dispatch Exception: Source: Microsoft Office Excel Description: Die Open-Methode des Workbooks-Objektes konnte nicht ausgeführt werden. Help File: C:\Programme\Microsoft Office\OFFICE11\1031\xlmain11.chm Help Context ID: 0
Error in ==> dataSave at 25 ExcelWorkbook = Excel.workbooks.Open(fileName);
Error in ==> Velo2Xls>save_Callback at 321 dataSave(handles.time, handles.outdata, outHeader);
??? Error while evaluating uicontrol Callback
any ideas?

Antworten (0)

Kategorien

Mehr zu Use COM Objects in MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by