彰化一整天的論壇

 找回密碼
 立即註冊
查看: 549|回復: 0

excel 指定滑鼠座標並點擊

[複製鏈接]
發表於 2016-2-13 19:51:39 | 顯示全部樓層 |閱讀模式
  1. Public Declare Function GetSystemMetrics Lib "user32.dll" (ByVal index As Long) As Long
  2. Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
  3. Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
  4. Public Const XX = 1920
  5. Public Const YY = 1080
  6. Public Const SM_CXSCREEN = 0
  7. Public Const SM_CYSCREEN = 1
  8. Sub TEST()
  9. x = [A1]: y = [A2]
  10. xaxis = GetSystemMetrics(SM_CXSCREEN) / XX
  11. yaxis = GetSystemMetrics(SM_CYSCREEN) / YY
  12. SetCursorPos x * xaxis, y * yaxis '指定滑鼠座標
  13. 'mouse_event &H2 Or &H4, 0, 0, 0, 0 '左鍵點擊
  14. 'mouse_event &H2 Or &H4, 0, 0, 0, 0 '左鍵點擊

  15. End Sub
  16. 複製代碼
複製代碼
資料來源: http://forum.twbts.com/viewthread.php?tid=1379
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

 ㄚ母滴雞湯
 員林香純滴雞精

Archiver|手機版|小黑屋|彰化一整天的論壇(Excel,Office)  |网站地图

GMT+8, 2019-10-16 08:32 , Processed in 0.119061 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表