我收到错误:在第
一行找不到方法或数据成员
.SendKeys("")
我正在从屏幕上抓取这个我发送的命令将光标放在正确的位置,然后在下一行发送命令来更改屏幕。我不明白为什么我收到这个错误。
Sub RLinfo()
Dim sys
Dim sess
Dim chan
Dim ws As Worksheet
Dim x As Integer
Dim y As Integer
Dim linecount As Long
' RL Information xxxx
Set Host = CreateObject("BZWh.WhllObj")
Host.OpenSession 0, 1, "xxxx.zmd", 30, 1
Set sess = Host.ActiveSession
Set chan = sess.Screen
Set ws = Worksheets("Information")
With ws
x = 14
y = 19
Set OUTPUTSHEET = ActiveWorkbook.Sheets("Information")
With chan
linecount = 2
Do While OUTPUTSHEET.Cells(linecount, 30) = "Zip"
RL = Format(OUTPUTSHEET.Cells(linecount, 1), "000000000")
.SendKeys ("<Home>")
.SendKeys ("/for x203<Enter>")
.waithostquiet (10)
.SendKeys (RL & "<Enter>")
.waithostquiet (10)
If Trim(.getstring(14, 2, 30)) = "RL WAS NOT FOUND" Then
OUTPUTSHEET.Cells(linecount, 20) = "RL No Longer In X203"
GoTo Found
Else
End If
OUTPUTSHEET.Cells(linecount, 17) = Trim(.getstring(11, 6, 6))
OUTPUTSHEET.Cells(linecount, 18) = Trim(.getstring(8, 27, 12))
OUTPUTSHEET.Cells(linecount, 19) = Trim(.getstring(9, 27, 12))
OUTPUTSHEET.Cells(linecount, 20) = Trim(.getstring(5, 41, 26))
For x = 14 To 20
If Trim(.getstring(x, 2, 7)) = "NUM" Then
OUTPUTSHEET.Cells(linecount, 21) = Trim(.getstring(x, 11, 11))
GoTo Found
Else
End If
Next x
If Trim(.getstring(23, 72, 6)) = "N MORE" Then
.SendKeys ("<PA1>")
.waithostquiet (10)
For y = 19 To 22
If Trim(.getstring(y, 2, 7)) = "NUM" Then
OUTPUTSHEET.Cells(linecount, 21) = Trim(.getstring(y, 11, 11))
GoTo Found
Else
End If
Next y
Else
End If
Found:
linecount = linecount + 1
Loop
End With
End With
ws.Cells(2, 31) = linecount
endM:
End Sub
答案 0 :(得分:0)
我的问题的原因是当我在模块之间移动时,我没有断开与主机的连接。在每个模块的开始,我重新连接到主机,即使我没有在前一个模块中断开连接,这导致运行时错误。