excel - 如何修复“无法运行宏”错误?
问题描述
当我将“Application.OnKey”与我的 tetr 对象一起使用时,我得到了错误,但是当我使用简单的 sum 函数进行测试时,一切正常。如果需要,我可以提供该类的代码。
错误:无法运行宏“C:\Path\File.xlsm'!'MoveDown tetr”。该工作簿中的宏可能不可用
Sub Game()
Dim tetr As New tetromino
Application.OnKey "{DOWN}", "'MoveDown tetr'"
End Sub
Sub MoveDown(tetr As tetromino)
tetr.PosY = tetr.PosY - 1
End Sub
解决方案
对我来说,GetAsyncKeyState 是解决方案。
推荐阅读
- flutter - 在 Flutter 2.5 和 Riverpod 中使用 ObjectBox / Instantiate store 和 box
- sum - QLIK Sense(与条件相加)
- command-line - 如何停止队列的无限循环:laravel中的工作命令?
- ios - 从 Visual Studio for Mac 在 M1 Mac 上调试 iOS 应用程序?
- node.js - 将未公开的 NodeJS 应用程序订阅到 SNS
- excel - 来自两个单独单元格的交叉引用文本并在相邻单元格中显示匹配
- php - 正则表达式从字符串中分离出内联样式的特定部分
- typescript - GraphQL Codegen – 如何使 Partial 成为解析器的返回类型,但保留所需的参数?
- azure-devops - Azure DevOps 管道根目录
- c - 如何在 C 中调整哈希表的大小?数组拒绝改变