I am trying to run a code that shows all comments when a worksheet is activated. Then 5 seconds later all the commends are hidden. I am receiving an error at the 5 second mark where it says "Cannot run the macro (filepath). The macro may not be available in this workbook or all macros may be disabled."
我正在尝试运行一个代码,在激活工作表时显示所有注释。然后5秒钟后,所有的表扬都被隐藏了。我在5秒标记处收到错误,其中显示“无法运行宏(文件路径)。宏可能在此工作簿中不可用,或者可能禁用所有宏。”
I've gone to the trust center and checked the box in the macro page and enabled all macros. I've added the filepathe on the shared drive to my trusted locations. I've tried copying the file to my docs and running it locally. No luck.
我去了信任中心并检查了宏页面中的框并启用了所有宏。我已将共享驱动器上的filepathe添加到我信任的位置。我已经尝试将文件复制到我的文档并在本地运行它。没有运气。
What gives?
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
Error Message Screenshot
错误消息截图
1 个解决方案
#1
3
Try moving your Sub CloseComments
to a standard module instead of the sheet module and it should work.
尝试将Sub CloseComments移动到标准模块而不是表单模块,它应该可以工作。
#1
3
Try moving your Sub CloseComments
to a standard module instead of the sheet module and it should work.
尝试将Sub CloseComments移动到标准模块而不是表单模块,它应该可以工作。