返回列表 上一主題 發帖

[發問] 關於用excel vba發訊息

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
    Dim myKey As Object
    Set myKey = CreateObject("WScript.Shell")
   

   a = SetCursorPos(20, 430) '移動至Line對話視窗
         mouse_event 2, 0, 0, 0, 0     '下壓左滑鼠
         mouse_event 4, 0, 0, 0, 0     '放鬆左滑鼠
           Sleep (500)
         myKey.SendKeys "Hello, I'm VBA message"
           Sleep (500)
         myKey.SendKeys "{ENTER}"
          Sleep (500)
         myKey.SendKeys "{ENTER}"
          Sleep (500)


小弟用最愚笨的方法寫的,請笑納!!

TOP

        靜思自在 : 唯其尊重自己的人,才更勇於縮小自己。
返回列表 上一主題