End If
End If
xHandle = apiGetWindow(xHandle, mcGWHWNDNEXT)
Loop
End Function
Public Function Cursor_move(x As Integer, y As Integer)
SetCursorPos x, y
Sleep 50
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
Sleep 500
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.Wait (Now + TimeValue("0:00:01"))
End Function
Public Function Press_Find()
' SendKeys " " ' right Click and select all
' Sleep 50
' mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
' Sleep 50
' mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
' Call Cursor_move(500, 310)
Sleep 50
SendKeys "^{V}"
Sleep 50
Call Cursor_move(435, 425) ' press adding Arrow
Sleep 100
Call Cursor_move(900, 50)
Sleep 100
Call Cursor_move(900, 80)
Application.Wait (Now + TimeValue("0:00:01"))
End Function
Sub Assign_ITRS()
Dim i, j As Integer
Dim obj As New DataObject
Range("A1").FormulaR1C1 = "=SUBTOTAL(3,R4C2:R99149C2)"
Dim Templet, tag, tagwithTemp As String
Templet = ""
j = Range("A1").Value
Range("B3").Select
Templet = "MENA"
tag = "MENA"
For i = 1 To j
obj.SetText Selection.Text
obj.PutInClipboard
tag = Selection.Text
Call EnterTAG
tagwithTemp = "Assign Template for " & tag & " - \\Remote"
If FindWindow(tagwithTemp) = 1 Then
Add_Template
ActiveCell.Offset(0, 10).Value = "Assigned"
Else
ActiveCell.Offset(0, 10).Value = "Error"
Exit Sub
GoTo NextIteration
End If
NextIteration:
Next i
End Sub
Sub testmouselocation()
' Call Cursor_move(435, 425) ' select TAG place in CM
SetCursorPos 900, 80
End Sub