Workbooks.Open返回错误的对象 [英] Workbooks.Open returns wrong object

查看:933
本文介绍了Workbooks.Open返回错误的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已经工作多年的旧VB6程序,升级到Excel 2016的用户开始报告问题。在调查时,似乎Workbook.Open方法正确地打开工作簿,但是将引用
返回到错误的工作簿对象。 


这是一个已知的错误Excel 2016?


我希望通过使用文件名在Workbooks集合中找到正确的对象来解决问题,但是如果有可用于Excel的更新或补丁,我可以向我们的用户推荐这个,而不是每个人都为
生成一个新版本。


Phil

解决方案

嗨Phil,


你得到了什么错误?我假设您收到错误"运行时错误'9'"。


您可以尝试关闭所有工作簿并重新启动Excel。


如果问题仍然存在,您可以尝试使用以下链接中的步骤对Workbooks Collection进行故障排除:


对工作簿集合进行故障排除


有关详细信息,请查看以下链接:


Excel VBA:Workbooks.Open返回错误的对象


希望它可以帮到你。


最好的问候,


Yuki


I have an old VB6 program that has been working for many years, and users who have upgraded to Excel 2016 are starting to report problems. On investigation it appears that the Workbooks.Open method is opening the workbook correctly, but is returning a reference to the wrong workbook object. 

Is this a known bug in Excel 2016?

I expect I can workaround the problem, by using the filename to find the correct object in the Workbooks collection, but if there is an update or patch available for Excel, I can recommend this to our users rather than having to produce a new version for everyone.

Phil

解决方案

Hi Phil,

What error did you get? I assumed that you get an error of "Run-Time error '9' ".

You could try to close all workbooks and relaunch the Excel first.

If the problem persists, you could try the steps in the following link to troubleshoot your Workbooks Collection:

Troubleshooting the Workbooks Collection

For more information, please review the following link:

Excel VBA: Workbooks.Open returns the wrong object

Hopefully it helps you.

Best Regards,

Yuki


这篇关于Workbooks.Open返回错误的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆