マウス操作
A B C D E1 Rclick 983 265 - asdfgh2 sleep 500 - - asdrty3 Lclick 653 774 - qwefgh4 sleep 500 - - qwerty クリップボードとデータのやりとりをする:Excel VBA|即効テクニック|Excel VBAを学ぶならmougwww.moug.netMPP Utilityの詳細情報 : Vector ソフトを探す!マウスポインタ位置情報に関した様々な機能を提供する統合ユーティリティwww.vector.co.jpーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーPrivate Type Position x As Long y As LongEnd TypeDeclare Function SetCursorPos Lib "User32" (ByVal x As Long, ByVal y As Long) As LongDeclare Sub mouse_event Lib "User32" ( _ ByVal dwFlags As Long, _ Optional ByVal dx As Long = 0, _ Optional ByVal dy As Long = 0, _ Optional ByVal dwDate As Long = 0, _ Optional ByVal dwExtraInfo As Long = 0)Declare Function GetCursorPos Lib "User32" (lpPoint As Position) As LongPrivate Declare Sub Sleep Lib "kernel32" (ByVal ms As Long)ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーSub LeftClick() mouse_event 2 mouse_event 4End SubーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーSub RightClick() mouse_event 8 mouse_event 16End SubーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーSub Sample2() Dim WSH As Object Set WSH = CreateObject("WScript.Shell") WSH.Popup "5秒後、自動的に閉じます", 1, "Title", vbInformation Set WSH = NothingEnd SubーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーSub 座標を調べる() Dim pos As Position Call GetCursorPos(pos) Debug.Print pos.x, pos.y MsgBox pos.x & ", " & pos.yEnd SubーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーSub メイン操作()Application.ScreenUpdating = Falsegoal = Cells(Rows.Count, 5).End(xlUp).RowFor st = 1 To goal Dim buf As String, buf2 As String, CB As New DataObject buf = Cells(st, 5).Value With CB .SetText buf ''変数のデータをDataObjectに格納する .PutInClipboard ''DataObjectのデータをクリップボードに格納する End With For turn = 1 To Cells(Rows.Count, 1).End(xlUp).Row t = Cells(turn, 1).Value x = Cells(turn, 2).Value y = Cells(turn, 3).Value Select Case t Case "sleep" Sleep (x) Case "Lclick" SetCursorPos x, y '調べておいた座標を入力 LeftClick Case "Rclick" SetCursorPos x, y '調べておいた座標を入力 RightClick Case "sendkey" SendKeys "ABC" End Select Next Dim WSH As Object Set WSH = CreateObject("WScript.Shell") WSH.Popup st & "/" & goal & "完了!!", 1, "Title", vbInformation Set WSH = NothingNextMsgBox "全" & goal & "回 完了!!"Application.ScreenUpdating = TrueEnd SubーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーSub 文字列パターン()'各列最終行取得a = Cells(Rows.Count, 1).End(xlUp).Rowb = Cells(Rows.Count, 2).End(xlUp).Rowc = Cells(Rows.Count, 3).End(xlUp).Row'1行目から各列最終行まで繰り返しFor st = 1 To a For nd = 1 To b For rd = 1 To c x = x + 1 Cells(x, 5) = Cells(st, 1) & Cells(nd, 2) & Cells(rd, 3) 'E列に結合して転記 Next rd Next ndNext stEnd Subーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー