vba 宏在不同的计算机上没有响应

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28059442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 05:54:10  来源:igfitidea点击:

Macro not responding on different computer

excelvbaexcel-vba

提问by Filippo

I have a macro which works fine on my computer when I click its button but it does not work on different computers. All the macros on that excel file are not working when clicking on the button.

我有一个宏,当我单击它的按钮时,它可以在我的计算机上正常工作,但它在不同的计算机上不起作用。单击该按钮时,该 Excel 文件上的所有宏都不起作用。

However, I have a macro working before saving. That means that when I try to save, another macro works properly. (that macro pop up an input message, but is not relevant now). So it seems that macros are not working only when you call them by a click...

但是,我在保存之前有一个宏在工作。这意味着当我尝试保存时,另一个宏可以正常工作。(该宏弹出输入消息,但现在不相关)。因此,似乎只有当您通过单击调用宏时,宏才起作用...

The version of Excel is the same one and I enabled the macro when asked.

Excel 的版本是相同的,我在询问时启用了宏。

It is not a problem of the code because even if I create a new simple macro on that file from the different PC (such as:

这不是代码的问题,因为即使我从不同的 PC 在该文件上创建了一个新的简单宏(例如:

msgbox("hello")

) it is still not responding.

)它仍然没有响应。

I had a problem with that excel file in the past and I had to manually delete all the *.exd extensions in my computer. However once I deleted those extensions, the file worked well.

我过去遇到过那个 excel 文件的问题,我不得不手动删除计算机中的所有 *.exd 扩展名。但是,一旦我删除了这些扩展名,该文件就运行良好。

I believe that the excel file is considered corrupted by other computers and they do not enable the macro. This is just my impression but I cannot get why the macro is working when saving and not working when clicking.

我相信 excel 文件被其他计算机认为已损坏,并且它们没有启用宏。这只是我的印象,但我不明白为什么宏在保存时起作用,而在单击时不起作用。

Do you have any idea to solve the problem?

你有什么想法来解决这个问题吗?

采纳答案by djevulen

I had issues like that myself both with macros and with Excel workbook doing some really funny stuff (like formulas not calculating properly, or functions not working as expected etc) and I did not find any other solution then copying the content of the file and pasting into a newly created file. In each case this resolved my problem. It suggests that my files somehow got corrupted and the only solution was to save the contents and delete the files. Exporting the .frm and .frx files from VBEditor (Modules and Forms) worked fine for me. Have you tried this yourself?

我自己在宏和 Excel 工作簿上都遇到了类似的问题,它们做了一些非常有趣的事情(例如公式计算不正确,或者函数无法按预期工作等),我没有找到任何其他解决方案,然后复制文件的内容并粘贴到一个新创建的文件中。在每种情况下,这都解决了我的问题。它表明我的文件以某种方式损坏了,唯一的解决方案是保存内容并删除文件。从 VBEditor(模块和表单)导出 .frm 和 .frx 文件对我来说效果很好。你自己试过这个吗?

回答by Lucas Kellner

This may be too simple a suggestion, but have you checked the security settings in Excel? The other computers may be set to a higher security setting that disables all macros without notifying the user.

这可能是一个过于简单的建议,但您是否检查过 Excel 中的安全设置?其他计算机可能设置为更高的安全设置,禁用所有宏而不通知用户。

https://support.office.com/en-US/Article/Enable-or-disable-macros-in-Office-documents-7b4fdd2e-174f-47e2-9611-9efe4f860b12?ui=en-US

https://support.office.com/en-US/Article/Enable-or-disable-macros-in-Office-documents-7b4fdd2e-174f-47e2-9611-9efe4f860b12?ui=en-US