不能运行macros,可能被禁用

我试图运行一个代码,显示所有评论当工作表被激活。 然后5秒钟后,所有的表扬都隐藏起来。 我收到一个错误,在5秒的地方说:“不能运行macros(文件path)。macros可能无法在此工作簿或所有macros可能被禁用。

我已经去信任中心,并检查macros页面中的框,并启用所有的macros。 我已将共享驱动器上的filepathe添加到我的受信任位置。 我试图将文件复制到我的文档并在本地运行。 没有运气。

是什么赋予了?

Dim TimeToRun Private Sub Worksheet_Activate() Application.DisplayCommentIndicator = xlCommentAndIndicator TimeToRun = Now + TimeValue("00:00:05") Application.OnTime TimeToRun, "CloseComments" End Sub Sub CloseComments() Application.DisplayCommentIndicator = xlCommentIndicatorOnly End Sub 

错误消息截图 错误消息截图

尝试将您的Sub CloseComments移动到标准模块,而不是表单模块,它应该工作。