choose Excel Com Server Version

2 visualizzazioni (ultimi 30 giorni)
Martin1986
Martin1986 il 26 Gen 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?

Risposte (0)

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by