如何解决使用 AutoHotKey 为 VBA 宏指定快捷方式
有什么方法可以将 AutoHotKey 快捷键分配给 VBA 宏。
#IfWinActive,ahk_exe EXCEL.EXE
~Alt::vkFF
!h:: ->VBA procedure
#If
谁能帮帮我?谢谢
解决方法
AHK 代码:(带有错误处理和调试语句)
public class WeatherForecastWithConverterAttribute
{
[JsonConverter(typeof(DateTimeOffsetJsonConverter))]
public DateTimeOffset Date { get; set; }
public int TemperatureCelsius { get; set; }
public string Summary { get; set; }
}
VBA 代码:
#IfWinActive,ahk_exe EXCEL.EXE
~Alt::vkFF
!h::
try {
XL := ComObjActive("Excel.Application")
} catch {
MsgBox,16,Cann't obtain Excel!
return
}
MsgBox,64,Excel obtained successfully! ;for debugging purposes
try {
XL.Run("theSub")
} catch {
MsgBox,Cann't find "theSub" in the opened workbook!
}
#If
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。