I'm trying to grab info from Excel to paste into SAP with SAP GUI and I keep encountering the issue "End with without with". I noticed that by making into 'text lines 4 to 9 the problem is solved. What am I missing?
With SAPSession Dim objExcel Dim objSheet, intRow, i 'End with without with issue start: Set objExcel = GetObject(, "Excel.Application") Set objSheet = objExcel.ActiveWorkbook.ActiveSheet For i = 2 To objSheet.UsedRange.Rows.Count cOL1 = Trim(CStr(objSheet.Cells(i, 1).Value)) cOL2 = Trim(CStr(objSheet.Cells(i, 2).Value)) cOL3 = Trim(CStr(objSheet.Cells(i, 3).Value)) 'End of the issue last 6 lines .findById("wnd[0]/tbar[0]/okcd").Text = "/nZFFSCMCOMMENTS" .findById("wnd[0]").sendVKey 0 .findById("wnd[0]/usr/chkP_OPEN").Selected = True .findById("wnd[0]/usr/chkP_CLOSED").Selected = True .findById("wnd[0]/usr/ctxtP_BUKRS").Text = "003" .findById("wnd[0]/usr/ctxtS_KUNNR-LOW").Text = cOL1 .findById("wnd[0]/usr/txtS_DOCNO-LOW").Text = cOL2 .findById("wnd[0]/usr/ctxtS_CREDAT-LOW").Text = Cells(7, 1).Value .findById("wnd[0]/usr/ctxtS_CREDAT-HIGH").Text = Cells(7, 2).Value .findById("wnd[0]/usr/ctxtP_ALVVAR").Text = "/pdi" .findById("wnd[0]/usr/ctxtP_ALVVAR").SetFocus .findById("wnd[0]/usr/ctxtP_ALVVAR").caretPosition = 4 .findById("wnd[0]/tbar[1]/btn[8]").press End With
<br>