Office 2007升级打破4GL进度代码
我支持一些遗留的 4GL Progress 代码。我们的一台运行 4GL 的服务器在我不知情的情况下升级到了 Office 2007(很好,对吧?)。不管怎样,升级破坏了运行 excel.application COM 组件的一段代码。财务部门维护着一个 Excel 文档中的销售预测数字列表,以下代码加载这些数字:
CREATE
"Excel.application" chExcelApplication NO-ERROR.
ASSIGN
chExcelApplication:VISIBLE = NO NO-ERROR.
ASSIGN
chWorkbook = chExcelApplication:Workbooks:OPEN(STRING(i-infile)) NO-ERROR.
ASSIGN
chWorkSheet = chExcelApplication:Sheets:ITEM((1)) NO-ERROR.
IF input frame f-in Plan1 <> 0 THEN
Plan1 = input frame f-in Plan1.
ELSE
Plan1 = chWorkSheet:range(forecastColumn + "4"):VALUE.
IF input frame f-in Plan2 <> 0 THEN
Plan2 = input frame f-in Plan2.
ELSE
Plan2 = chWorkSheet:range(forecastColumn + "7"):VALUE.
IF input frame f-in Plan3 <> 0 THEN
Plan3 = input frame f-in Plan3.
ELSE
Plan3 = chWorkSheet:range(forecastColumn + "6"):VALUE.
当代码运行时,我收到以下错误:
“处理方法/语句时引用的组件句柄无效:范围。”
奇怪的是,A)它不会在“打开”命令或“创建”命令上失败 - 所以这似乎不是 COM 对象本身的问题。 B) 如果我在运行 Office 2007 的机器上运行相同的代码,它运行得很好。
关于如何解决这个问题有什么想法吗?
谢谢!
I'm supporting some legacy 4GL Progress code. One of our servers that runs 4GL was upgraded to Office 2007 without my knowledge (nice, right?). Anyway, the upgrade broke a segment of code that's running the excel.application COM component. Finance maintains a list of sales forecast numbers that they keep in an Excel document and the following code loads those numbers:
CREATE
"Excel.application" chExcelApplication NO-ERROR.
ASSIGN
chExcelApplication:VISIBLE = NO NO-ERROR.
ASSIGN
chWorkbook = chExcelApplication:Workbooks:OPEN(STRING(i-infile)) NO-ERROR.
ASSIGN
chWorkSheet = chExcelApplication:Sheets:ITEM((1)) NO-ERROR.
IF input frame f-in Plan1 <> 0 THEN
Plan1 = input frame f-in Plan1.
ELSE
Plan1 = chWorkSheet:range(forecastColumn + "4"):VALUE.
IF input frame f-in Plan2 <> 0 THEN
Plan2 = input frame f-in Plan2.
ELSE
Plan2 = chWorkSheet:range(forecastColumn + "7"):VALUE.
IF input frame f-in Plan3 <> 0 THEN
Plan3 = input frame f-in Plan3.
ELSE
Plan3 = chWorkSheet:range(forecastColumn + "6"):VALUE.
When the code runs I get the following error:
"Invalid component-handle referenced while processing method/statement: Range."
The weird thing is that A) It doesn't fail on the "Open" command or the "Create" command - so it doesn't seem to be a problem with the COM object itself. And B) if i run the same code from my machine that also runs Office 2007, it runs just fine.
Any ideas on how I can troubleshoot this one?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将 Excel 的内容复制到一个新文件中,现在它可以正常提取数字了。诡异的...
I copied the contents of the excel into a new file, and it's pulling the numbers just fine now. Weird...