运行时错误'1004'-对象'工作簿'的方法'打开'失败 [英] Run-time Error '1004' - Method 'Open' of object 'Workbooks' failed

查看:77
本文介绍了运行时错误'1004'-对象'工作簿'的方法'打开'失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,到目前为止,我已经卸载了&重新安装Office-2010 3至4次,完成了3天的研究工作,但没有成功.我开始从Vbscript或Excel VBA中收到此错误,执行了已经使用了几个月的相同命令.我不确定自己可能更改了什么,我不记得要更改可能导致更改的任何内容,但是我将其固定在ReadOnly:=True参数上.我认为注册表可能有问题...但是重新安装应该可以解决问题吗?没...

OK, so far I've uninstalled & re installed Office-2010 3 to 4 times, done hours of research for 3 days with no success. I started getting this error either from Vbscript or Excel VBA, performing the same command that has worked for months. I am not sure what I may have changed, I don't recall changing anything that could cause it but I nailed it down to the ReadOnly:=True parameter. I think something may be wrong with the registry... but re-installing should fix it right? It didn't...

无论如何,我在Excel 2010上记录的非常简单的命令.此命令 WORKS FINE ,文件打开:

Anyways, very simple command that I recorded on Excel 2010. This command WORKS FINE and the file opens:

Sub Macro1()
     Workbooks.Open Filename:="C:\temp\file_9928_131101.xlsx"
End Sub

但是当我添加 ReadOnly:= True 参数时,它会不起作用:

But when I add the ReadOnly:=True parameter, it does NOT WORK:

Sub Macro1()
     Workbooks.Open Filename:="C:\temp\file_9928_131101.xlsx", ReadOnly:=True
End Sub

这是返回的错误 运行时错误'1004'对象'工作簿'的方法'打开'失败 :

This is the returned error Run-time error '1004' Method 'Open' of object 'Workbooks' failed:

当我单击调试"时,错误仅出现在代码行中.

When I click Debug, the error is at the only line of code.

推荐答案

文件已损坏. 使用其他名称保存并在功能中更改名称.尝试使其工作,然后在您要调用的文件中重命名该文件.

The file is corrupted. Resave it with another name and change the name in the function. Try that it works and after that rename the file as you want to call it.

它对我有用,我的文件已损坏.只读应该没问题.

It worked for me and I had a corrupted file. The read only shouldn't be a problem.

这篇关于运行时错误'1004'-对象'工作簿'的方法'打开'失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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