注:该脚本来之网络收集
;-----------------------------------
; 循环切换Excel的当前工作表 By FeiYue
;
; 注:在我的系统中不能 ComObjActive("Excel.Application")
;-----------------------------------
#A::
if (!objExcel)
{
ControlGet, hwnd, Hwnd,, EXCEL71, ahk_class XLMAIN
objExcel:=Acc_ObjectFromWindow(hwnd,0xFFFFFFF0).Application
}
i:=objExcel.ActiveSheet.Index, j:=objExcel.Worksheets.Count
objExcel.Worksheets[i<j?i+1:1].Activate
return
Acc_ObjectFromWindow(hWnd, idObject = -4)
{
Static h
If (!h)
h:=DllCall("LoadLibrary","Str","oleacc","Ptr")
If DllCall("oleacc\AccessibleObjectFromWindow"
, "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", (VarSetCapacity(IID,16)
+NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64")
+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,IID,8,"Int64"))*0
+&IID, "Ptr*", pacc)=0
Return ComObjEnwrap(9,pacc,1)
}
win+a 利用键盘按顺序切换工作表,好像用处不大,思路可利用.