title: Getting specific cell data from SAP to excel
body: <p>I am trying to get data from specific cells in a row in SAP, into an excel table using VBA. When I record a macro of me clicking the 5-6 items I need, it only gives me that I clicked one. Further more I cannot see any way to get the data from the cells, into SAP. The SAP code is here:</p>
  
  <pre><code>Dim W_Ret As Boolean
  
  W_Ret = Attach_Session
  If Not W_Ret Then
      Exit Sub
  End If
  
  startrow = 10
  
  On Error GoTo myerr
  
  objSess.findById("wnd[0]").maximize
  objSess.findById("wnd[0]/tbar[0]/okcd").Text = "/nymm_pricelist"
  objSess.findById("wnd[0]").sendVKey 0
  objSess.findById("wnd[0]/usr/ctxtS_MATNR-LOW").Text = Cells(currentline, 1).Value
  objSess.findById("wnd[0]/usr/ctxtS_VKORG-LOW").Text = Cells(currentline, 4).Value
  objSess.findById("wnd[0]/usr/ctxtS_VKORG-LOW").SetFocus
  objSess.findById("wnd[0]/usr/ctxtS_VKORG-LOW").caretPosition = 4
  objSess.findById("wnd[0]").sendVKey 8
  Set myGrid = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
  Cells(currentline, 5).Value = myGrid.GetCellValue(0, "MAKTX")
  Cells(currentline, 6).Value = myGrid.GetCellValue(0, "GLOBALSALES_KBETR")
  Cells(currentline, 7).Value = myGrid.GetCellValue(0, "GLOBALSALES_KONWA")
  Cells(currentline, 8).Value = myGrid.GetCellValue(0, "GLOBALTRANSFER_KBETR")
  Cells(currentline, 9).Value = myGrid.GetCellValue(0, "GLOBALTRANSFER_KONWA")
  
  
  ' Setting the line status to completed
  Cells(currentline, 2).Value = 1
  Exit Sub
  
  myerr:
  ' Some error occured
  ' Setting the line status to Failed
  Cells(currentline, 2).Value = 2
  </code></pre>
  
  <p>Any help is appreciated!</p>