a = Sheets(1).Cells(1, 1).Value
b = Sheets(1).Cells(2, 1).Value
If a <> b Then
a = Orderfunction(a, b)
Sheets(1).Cells(3, 1).Value = a
End If
End Sub
模組:
Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
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)
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 32 Bit Systems
Public Function Orderfunction(neworder As Integer, oldorder As Integer) As Integer
If neworder > 0 Then
a = SetCursorPos(480, 160) '移動至第二下單格
mouse_event 2, 0, 0, 0, 0 '下壓左滑鼠
mouse_event 4, 0, 0, 0, 0 '放鬆左滑鼠
Sleep (500)
a = SetCursorPos(300, 70)
mouse_event 2, 0, 0, 0, 0 '下壓左滑鼠
mouse_event 4, 0, 0, 0, 0 '放鬆左滑鼠
SendKeys Range("a1").Text
Sleep (500)
SendKeys "{ENTER}"
Sleep (500)
end if
end function作者: itooyess 時間: 2015-4-28 13:42