choose Excel Com Server Version

5 vues (au cours des 30 derniers jours)
Martin1986
Martin1986 le 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?

Réponses (0)

Catégories

En savoir plus sur Use COM Objects in MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by