如何解决DLL访问错误

发布于 2024-09-05 02:39:06 字数 119 浏览 5 评论 0原文

我正在使用 VBA 在 Access 中开发 Excel 项目。我的项目在 Access 2007 中运行,但在 Access 2003 中不起作用。如果我尝试运行该文件,它会显示 DLL 错误。有人知道如何调试这个错误吗?

I am developing an Excel project in Access using VBA. My project is working in Access 2007, but it does not work in Access 2003. If I try to run the file, it shows the DLL error. Anyone know how to debug this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖阳 2024-09-12 02:39:06

如果不知道您收到的错误消息以及错误发生的位置,就很难知道导致问题的原因。

我最好的猜测是你的参考资料有问题。通常,解决此问题的最佳方法是更改​​代码以使用后期绑定(如果每台计算机上的 Excel 版本并不总是相同)。

请考虑以下 3 个示例:

'This is early binding.
Dim oXLS As Excel.Application 
Set oXLS = New Excel.Application

'Create a new instance of an Excel Object using late binding
Dim oXLS As Object 
Set oXLS = CreateObject("Excel.Application")

'Set your object to an instance of Excel that is already open using late binding
Dim oXLS As Object 
Set oXLS = GetObject(, "Excel.Application")

使用早期绑定进行编程更容易,因为您可以使用智能感知。但是,如果您的目标计算机可能具有不同版本的 Excel,您应该考虑在生产/部署版本中使用后期绑定以获得更好的兼容性。

It's pretty difficult to know what's causing your problem without knowing what error message you are getting and where it's occurring.

My best guess says that you are have a problem with a reference. Usually the best way to fix this is to change your code to use late binding if the version of Excel will not always be the same on every machine.

Consider the following 3 examples:

'This is early binding.
Dim oXLS As Excel.Application 
Set oXLS = New Excel.Application

'Create a new instance of an Excel Object using late binding
Dim oXLS As Object 
Set oXLS = CreateObject("Excel.Application")

'Set your object to an instance of Excel that is already open using late binding
Dim oXLS As Object 
Set oXLS = GetObject(, "Excel.Application")

It's easier to program using early binding because you can use intellisense. However, if your target machines might have differing versions of Excel you should consider using late binding in your production/deployment version for better compatibility.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文