问题描述
有什么方法可以将 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