fafa68868 发表于 2016-4-12 12:29:02

vba中如何单击一个shape?

请问如何在幻灯片放映时获得一个shape的位置范围,并完成在该范围内鼠标单击?

hjghjg 发表于 2016-4-12 14:34:53

我在网上找了一段代码:
Option Explicit
    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 _
    )
Dim Option_Tag As Integer
Dim OnTest As Boolean
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_MIDDLEDOWN = &H20
Const MOUSEEVENTF_MIDDLEUP = &H40
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Sub Timer()
    mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
这段代码好象能模拟鼠标单击按纽
我想让鼠标进入某个区域单击一次这个按纽,鼠标离开这个区域再单击一次这个按纽。希望懂api的高手帮帮我!

user_rxtmf 发表于 2016-4-12 14:43:46


maggie170101 发表于 2016-4-12 16:33:03

感谢ngcg兄的帮助,能否继续出手帮一把!

ght3312 发表于 2016-4-12 16:38:08

我不明白您的要求,实在爱莫能助。
页: [1]
查看完整版本: vba中如何单击一个shape?