I made a VBA project based on Excel and Access. When I copied to other computers, some methods (left, right, etc) or controls (ComboBox) sometimes disabled. I had to rebuild in that computer. But sometimes it's OK. Why? Is that because of licence issues?
我基于Excel和Access制作了一个VBA项目。当我复制到其他计算机时,某些方法(左,右等)或控件(ComboBox)有时会被禁用。我不得不在那台电脑上重建。但有时它没关系。为什么?是因为许可证问题?
4 个解决方案
#1
Check the references on the computer that it is failing on (via tools/references menu item in the VBA editor). Different platforms can have different sets of DLLs installed and you will get some misleading errors from excel if there is a reference that is marked "MISSING".
检查计算机上的参考是否失败(通过VBA编辑器中的工具/参考菜单项)。不同的平台可以安装不同的DLL集,如果有一个标记为“MISSING”的引用,您将从excel中获得一些误导性错误。
This is discussed in this question
这个问题在这个问题中讨论过
#2
This is a version difference/missing reference issue. Sometimes it gives you the error on the correct function, and sometimes on completely unrelated functions.
这是版本差异/缺少参考问题。有时它会在正确的函数上给出错误,有时会在完全不相关的函数上给出错误。
If you are deploying to different versions of Excel you can use late binding instead of early binding to relieve this problem. When you are developing you can use stuff like
如果要部署到不同版本的Excel,则可以使用后期绑定而不是早期绑定来缓解此问题。在开发时,你可以使用像
Dim x As Excel.Application
x = New Excel.Application
But for deployment you can change it to the following and then remove the reference altogether.
但是对于部署,您可以将其更改为以下内容,然后完全删除引用。
Dim x As Object
x = CreateObject("Excel.Application")
#3
Not because on licensing. A lot of factors could be, but I could nail it down to: Depending on the Office SP version differences on multiple computers, it might give you headaches. Also check the Office Web Components version of each. Your Options & Add-in on Office might give you some clues.
不是因为许可。可能有很多因素,但我可以将其归结为:根据多台计算机上的Office SP版本差异,它可能会让您头疼。另请检查每个的Office Web Components版本。您在Office上的选项和加载项可能会为您提供一些线索。
#4
It is important to check security and permissions on the computer that you are having problems on. Users must have full permissions on both the fron-end and back-end folders. Macros will not run if security settings do not permit them. You may wish to read:
检查您遇到问题的计算机上的安全性和权限非常重要。用户必须拥有前端和后端文件夹的完全权限。如果安全设置不允许,宏将无法运行。您可能希望阅读:
Self certification and digital signatures
自我认证和数字签名
General information on security principals for Office code and macro security
有关Office代码和宏安全性的安全主体的一般信息
Trusted location defaults for Office 2003
Office 2003的受信任位置默认值
Office 2003中的宏安全性
For the most part, late binding will solve problems with references in VBA, unless you have some unusual references. Most problems are caused by differences in library versions that can be overcome with late binding. With VBA, it is often recommended that you develop with early binding but release with late binding. The main disadvantage of late binding is changing built-in constants to values (speed is no longer the issue it used to be.)
在大多数情况下,后期绑定将解决VBA中引用的问题,除非您有一些不寻常的引用。大多数问题是由库版本的差异引起的,这些差异可以通过后期绑定来克服。对于VBA,通常建议您使用早期绑定进行开发,但使用后期绑定进行发布。后期绑定的主要缺点是将内置常量更改为值(速度不再是以前的问题。)
#1
Check the references on the computer that it is failing on (via tools/references menu item in the VBA editor). Different platforms can have different sets of DLLs installed and you will get some misleading errors from excel if there is a reference that is marked "MISSING".
检查计算机上的参考是否失败(通过VBA编辑器中的工具/参考菜单项)。不同的平台可以安装不同的DLL集,如果有一个标记为“MISSING”的引用,您将从excel中获得一些误导性错误。
This is discussed in this question
这个问题在这个问题中讨论过
#2
This is a version difference/missing reference issue. Sometimes it gives you the error on the correct function, and sometimes on completely unrelated functions.
这是版本差异/缺少参考问题。有时它会在正确的函数上给出错误,有时会在完全不相关的函数上给出错误。
If you are deploying to different versions of Excel you can use late binding instead of early binding to relieve this problem. When you are developing you can use stuff like
如果要部署到不同版本的Excel,则可以使用后期绑定而不是早期绑定来缓解此问题。在开发时,你可以使用像
Dim x As Excel.Application
x = New Excel.Application
But for deployment you can change it to the following and then remove the reference altogether.
但是对于部署,您可以将其更改为以下内容,然后完全删除引用。
Dim x As Object
x = CreateObject("Excel.Application")
#3
Not because on licensing. A lot of factors could be, but I could nail it down to: Depending on the Office SP version differences on multiple computers, it might give you headaches. Also check the Office Web Components version of each. Your Options & Add-in on Office might give you some clues.
不是因为许可。可能有很多因素,但我可以将其归结为:根据多台计算机上的Office SP版本差异,它可能会让您头疼。另请检查每个的Office Web Components版本。您在Office上的选项和加载项可能会为您提供一些线索。
#4
It is important to check security and permissions on the computer that you are having problems on. Users must have full permissions on both the fron-end and back-end folders. Macros will not run if security settings do not permit them. You may wish to read:
检查您遇到问题的计算机上的安全性和权限非常重要。用户必须拥有前端和后端文件夹的完全权限。如果安全设置不允许,宏将无法运行。您可能希望阅读:
Self certification and digital signatures
自我认证和数字签名
General information on security principals for Office code and macro security
有关Office代码和宏安全性的安全主体的一般信息
Trusted location defaults for Office 2003
Office 2003的受信任位置默认值
Office 2003中的宏安全性
For the most part, late binding will solve problems with references in VBA, unless you have some unusual references. Most problems are caused by differences in library versions that can be overcome with late binding. With VBA, it is often recommended that you develop with early binding but release with late binding. The main disadvantage of late binding is changing built-in constants to values (speed is no longer the issue it used to be.)
在大多数情况下,后期绑定将解决VBA中引用的问题,除非您有一些不寻常的引用。大多数问题是由库版本的差异引起的,这些差异可以通过后期绑定来克服。对于VBA,通常建议您使用早期绑定进行开发,但使用后期绑定进行发布。后期绑定的主要缺点是将内置常量更改为值(速度不再是以前的问题。)