返回列表 上一主題 發帖

[發問] 如何使用excel 發送文字訊息

[發問] 如何使用excel 發送文字訊息

各位大大好,我想將儲存格a1的值,傳送到例如line或任何視窗上面,我是用以下方式撰寫,但會發生"沒有使用權限"
請問該如何解決???

或者有什麼比較好相容的建議嗎??

Sub sdfadf()

Dim a As Integer
Dim b As Integer

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

是的,移動滑鼠後點擊輸入

TOP

        靜思自在 : 發脾氣是短暫的發瘋。
返回列表 上一主題