Excel Automation突然提出异常 - 无法弄清楚原因 [英] Excel Automation suddenly raising exceptions - cannot figure out why
问题描述
使用Visual Studio(2005和/或2017)C ++(MFC)
我们的Excel自动化代码已经运行了超过15年,但仅在几台机器上我们突然得到自动化异常,我们无法弄明白。
// m_ExcelBooks是一个Workbooks类,在调用
VERIFY(lpDisp = m_ExcelBooks.Add(COleVariant(Program()。m_dataTransfer.m_templateName)));
然后我们收到一条错误消息
"Add method of工作簿类失败"
(模板确实存在并将加载到Excel中,如果我从Excel手动完成)
我试过重新安装我们的软件,没有快乐
我试过修复并重新安装Office,没有快乐
我唯一能在任何地方安装Office 2007的副本并强制打开XLT文件,它绕过了失败的Office 2016版本。
这让我觉得Windows'自动化'Excel的方式搞砸了。
如果有人有任何想法他们会非常感激
非常感谢先进
Phil C。
它是否适用于Excel 2016中制作的其他模板?
Using Visual Studio (2005 and/or 2017) C++ (MFC)
We have Excel Automation code that has worked for over 15 years but on just a few machines we are suddenly getting Automation exceptions and we cannot figure it out.
// m_ExcelBooks is a Workbooks class and appears to be valid before the call
VERIFY(lpDisp=m_ExcelBooks.Add(COleVariant(Program().m_dataTransfer.m_templateName)));
Then we get an error message
"Add method of workbooks class failed"
(The template does exist and will load into Excel if I do it manually from Excel)
I’ve tried re-installing our software, no joy
I’ve tried repairing and re-installing Office, no joy
The only time I got anywhere was to install a copy of Office 2007 and force XLT files to open with that and it bypassed the Office 2016 version that was failing.
This makes me think that something has been messed up in the way Windows ‘automates’ Excel.
If anyone has any ideas they would be much appreciated
Many thanks in advanced
Phil C.
Does it work with other templates made in Excel 2016?
这篇关于Excel Automation突然提出异常 - 无法弄清楚原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!