:???: :???: SENDKEYS sorun! :???: :???: :???:

Katılım
3 Mayıs 2008
Mesajlar
2
Excel Vers. ve Dili
visual basic
:???: arkadaşlar merhaba sendkeys methoduyla excelden başka bir programa veri giriyorum fakat ilk satırdaki verileri istediğim gibi alıyor fakat ikinci sütuna geçemiyorum loop metodunu kullandım fakat devamlı aynı satırı tekrarlıyor ve sütundaki bütün veriler bitince durmuyor. yardımcı olabilir misiniz?


Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As _
Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal _
dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_ALT = &H12
Private Const VK_TAB = &H9


Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Public Sub Wait(Seconds As Double)

Dim lMilliSeconds As Long
lMilliSeconds = Seconds * 1000
Sleep lMilliSeconds

End Sub

Private Sub CommandButton1_Click()
Dim IPTAL
Dim k
Dim i
Dim j
Dim MyDataObj As New DataObject
Dim TEXT As String
Dim ADET As Integer

k = 2
i = 2
j = 0

SendKeys ("%{tab}")
2
Do While 1
IPTAL = 1
SendKeys "{enter}", True
Wait (0.1)
SendKeys "{esc}", True
Wait (0.1)
SendKeys Cells(i, 2)
Wait (0.1)
SendKeys "{tab}", True
Wait (0.1)
SendKeys "{right}"
Wait (0.1)
SendKeys "{tab}", True
Wait (0.1)
SendKeys "T", True
Wait (0.1)
SendKeys Cells(i, 3), True
Wait (0.1)
SendKeys "{tab}", True
Wait (0.1)
SendKeys "{enter}", True
Wait (0.1)
SendKeys Cells(i, 4)

Wait (0.1)

SendKeys "{enter}", True
Wait (0.1)
SendKeys "{enter}", True
Wait (0.1)
SendKeys "{enter}", True
Wait (0.1)
If Cells(i, 1) = i + 1 And Cells(i, 5).Value = Cells(i - 1, 5).Value Then
ElseIf Cells(i, 1) = 0 Then

GoTo 2

ElseIf "a" & Cells(i, 1) = "a" Or Cells(i, 1) = "" Or Cells(i, 1) = Null Then
i = i + 1
Exit Sub
End If
Loop
End Sub
Function GETCLIPBOARD()
Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
GETCLIPBOARD = MyDataObj.GetText
End Function

Function alttab()
' Press Alt.
keybd_event VK_ALT, 0, 0, 0
DoEvents

' Press Tab.
keybd_event VK_TAB, 1, 0, 0
DoEvents

' Release Alt.
keybd_event VK_ALT, 0, KEYEVENTF_KEYUP, 0
DoEvents

End Function
 
Üst