Código com erro nas seguintes linhas:
1° ERRO:
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").pressContextButton "SELECT"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").SelectContextMenuItem ("Purchase_Requisitions")
2° ERRO:
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectItem " 1", "&Hierarchy"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").ensureVisibleHorizontalItem " 1", "&Hierarchy"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").pressButton "COPY"
Não estou conseguindo resolver, já tentei de tudo.
Segue código detalhado.
Sub Criar_OC()
Call Star_SAP
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nme21n"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").pressContextButton "SELECT"
If Err = 0 Then
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").pressContextButton "SELECT"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").SelectContextMenuItem ("Purchase_Requisitions")
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").Text = "19032374"
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").caretPosition = 8
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").caretPosition = 8
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectItem " 1", "&Hierarchy"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").ensureVisibleHorizontalItem " 1", "&Hierarchy"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").pressButton "COPY"
If Err <> 0 Then
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").pressContextButton "SELECT"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").SelectContextMenuItem ("Purchase_Requisitions")
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").Text = "19032374"
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").caretPosition = 8
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").SetFocus
session.findById("wnd[0]/usr/ctxtSP$00026-LOW").caretPosition = 8
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").selectItem " 1", "&Hierarchy"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[1]").ensureVisibleHorizontalItem " 1", "&Hierarchy"
session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell[0]").pressButton "COPY"
End If
End If