choose Excel Com Server Version

5 ビュー (過去 30 日間)
Martin1986
Martin1986 2012 年 1 月 26 日
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?

回答 (0 件)

カテゴリ

Help Center および File ExchangeUse COM Objects in MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by