Tag: c ++ builder xe7

Excel自动化在C ++ Builder XE7中不起作用

我正在尝试使用下面的代码在RAD Studio XE7中从C ++ Builder打开一个.xlsx文件: #include "ComObj.hpp" Variant Excel = CreateOleObject("Excel.Application"); Variant Books = Excel.OlePropertyGet("Workbooks"); Excel.OlePropertySet("Visible", true); // An escape character is missing but the problem remains Books.OleProcedure("Open", L"D:\1.xlsx"); // exception here 但最后一行导致exception与消息: Project2.exe引发exception类EOleException,并显示消息'ссталению,намнеудалосьнастифайлИСТИНА.xlsx。 Возможно,онбылперемещен,переименованилиудален?' 俄语翻译: Project2.exe引发exception类EOleException消息'不幸的是,我们无法find文件TRUE.xlsx。 它可能已被移动,重命名或删除?“。 屏幕与源中断的地方 在Delphi中的代码似乎正常工作: uses ComObj; var Excel, Books: Variant; begin Excel := CreateOleObject('Excel.Application'); Books := Excel.Workbooks; Excel.Visible := […]