私はHostExplorerメインフレームターミナルエミュレータで作業しています。私のVBAの知識は、私が他のマクロを作るためにオンラインで見つけた情報の断片をつなぎ合わせることに基づいています。HostExplorerメインフレームエミュレータ画面のフィールドにExcelテキストを入力
メインフレームに請求書を入力し、いくつかの画面間を移動し、リンクを生成する情報を入力し、そのリンクを使用してコンピュータの所定のフォルダにファイルを保存するマクロを作成しています。
入力情報部分に固執しています。最後の画面に移動した後、メインフレームの特定のフィールドにテキストを入力する必要があります。
私は画面上の場所を特定し、それを変数の作成に使用する方法を知っています。
どうすればいいですか?変数を保持している文字列(またはランダムな文字)を画面の特定の場所に入力するにはどうすればよいですか?
Sub MiscFileDownload()
Dim HostExplorer As Object
Dim MyHost As Object
Dim Rc As Integer
On Error GoTo GenericErrorHandler
Set HostExplorer = CreateObject("HostExplorer") ' Initialize HostExplorer Object
Set MyHost = HostExplorer.HostFromProfile("*****") ' Set object for the desired session
If MyHost Is Nothing Then GoTo NoSession
Dim ColALastRow As Long
ColALastRow = Worksheets(1).Columns("A:A").End(xlDown).Row
Dim Pro As String
Dim MiscTest As String
Dim iPSUpdateTimeout
'enter pro then F2 and F9
For i = 2 To ColALastRow
Pro = Worksheets(1).Cells(i, 1).Value
Rc = MyHost.Keys(Pro)
iPSUpdateTimeout = 60
MyHost.RunCmd ("Enter")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
iPSUpdateTimeout = 60
MyHost.RunCmd ("PF2")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
iPSUpdateTimeout = 60
MyHost.RunCmd ("PF9")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
MiscTest = Mid(MyHost.Text, 1466, [3])
If MiscTest = "YES" Then 'test for Misc if true move to next screen
Rc = MyHost.Keys("v")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
MyHost.RunCmd ("Tab")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
Rc = MyHost.Keys("v")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
MyHost.RunCmd ("Tab")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
Else
MyHost.RunCmd ("PF1")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
MyHost.RunCmd ("PF1")
Rc = MyHost.WaitPSUpdated(iPSUpdateTimeout, True)
If Rc <> 0 Then GoTo OnWaitPSUpdatedTimeout
GoTo NextIteration
End If
NextIteration:
Next i
Exit Sub
テキストを入力するだけですか?私はあなたのホストが何であるか分かりませんが、key()メソッドを使用して入力できるように見えます! Like:MyHost.Keys( "thevalueyouwanttoType") –
MyHost.Keys( "thevalueyouwanttoType")は文字列を入力するために機能しますが、意味がある場合は特定の場所に入力する方法を知る必要がありますか? たとえば、MiscTest = Mid(MyHost.Text、1466、[3])は、その変数を "location?"で始まる文字列と等しく設定します。私のhostexplorerの1466 Myhost.keysを使用する前に特定の場所に移動するにはどうすればよいですか? – user2996913
http://vbcity.com/forums/t/42741.aspxこれは何らかの助けになるかもしれません。 –