Справка по мэйнфрейму Ibm требуется для установки макроса
Sub Texas() Dim wks As Workbook Dim app As Object On Error Resume Next Dim i As Integer Sheets("TEXAS").Activate Range("A1:D1000000").ClearContents Set app = GetObject("RIBM") Set app = GetObject("RIBM") If Trim(app.getdisplaytext(1, 32, 26)) = "SM972 Main Panel" Then app.MoveCursor 21, 7 app.TransmitANSI "1" app.TransmitTerminalKey 289 Application.Wait (Now() + TimeSerial(0, 0, 1)) app.MoveCursor 1, 1 app.TransmitANSI "row1" app.TransmitTerminalKey 289 Application.Wait (Now() + TimeSerial(0, 0, 1)) app.MoveCursor 19, 31 app.TransmitANSI "1" app.TransmitTerminalKey 289 Application.Wait (Now() + TimeSerial(0, 0, 1)) app.MoveCursor 20, 8 app.TransmitANSI "1" app.TransmitTerminalKey 289 Application.Wait (Now() + TimeSerial(0, 0, 1)) Range("A2").Activate i = 3 'Do Until Trim(app.getdisplaytext(i, 69, 10)) = "PAGE: 1" Do Until Trim(app.IsEmpty(i, 1, 11))"GETTING ERROR here 'Do Until (app.IsEmpty(i, 20, 5)) ActiveCell.Offset(0, 0).Value = Trim(app.getdisplaytext(i, 1, 11)) ActiveCell.Offset(0, 1).Value = Trim(app.getdisplaytext(i, 4, 11)) ActiveCell.Offset(0, 2).Value = Trim(app.getdisplaytext(i, 18, 5)) ActiveCell.Offset(0, 3).Value = Trim(app.getdisplaytext(i, 41, 1)) ActiveCell.Offset(0, 4).Value = Trim(app.getdisplaytext(i, 45, 7)) i = i + 1 i = 21 Then i = 3 app.TransmitTerminalKey 385 Application.Wait (Now() + TimeSerial(0, 0, 1)) End If ActiveCell.Offset(1, 0).Select Loop Else MsgBox "Please goto SELECTION MENU Screen..." End If app.TransmitTerminalKey 380 Application.Wait (Now() + TimeSerial(0, 0, 1)) app.TransmitTerminalKey 380 Application.Wait (Now() + TimeSerial(0, 0, 1)) app.TransmitTerminalKey 380 Application.Wait (Now() + TimeSerial(0, 0, 1)) app.MoveCursor 1, 1 app.TransmitANSI "ap" app.TransmitTerminalKey 289 Application.Wait (Now() + TimeSerial(0, 0, 1)) End Sub
Что я уже пробовал:
я хочу остановить цикл, когда диапазон пуст.
Richard MacCutchan
Какой диапазон, какая петля?