Bom dia,
Pessoal preciso de uma ajuda se possivel.
Tenho a macro sub parte2 e preciso deixar o script abaixo que tem o valor 9 em que esse 9 atualize de acordo com a informação da coluna E a partir da linha 3.
Cada linha que vai ser percorrida pode ser um numero diferente e gostaria de deixar essa informação automática
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").selectItem (" 9"), "&Hierarchy"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").ensureVisibleHorizontalItem " 9", "&Hierarchy"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").clickLink " 9", "&Hierarchy"
Sub Parte2()
If Not IsObject(Appl) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set Appl = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = Appl.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject Appl, "on"
End If
Windows("Consultar Status Nota Fiscal.xlsm").Activate
Sheets("Planilha3").Select
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "/NEDOC_COCKPIT "
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").selectItem (" 9"), "&Hierarchy"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").ensureVisibleHorizontalItem " 9", "&Hierarchy"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[1]/shell/shellcont[1]/shell").clickLink " 9", "&Hierarchy"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[0]/shell/shellcont[0]/shell/shellcont[2]/shell").sapEvent "Frame0", "sapbu_cl= &sapse_cl= &sapin_cl=A1F1I1NAME:LAST_DAYSsapENTER&A1F1I1=120", "sapevent:A1F1"
session.findById("wnd[1]/usr/btnBUTTON_1").press
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").setCurrentCell -1, "NFENUM"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").selectColumn "NFENUM"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").pressToolbarButton "&MB_FILTER"
session.findById("wnd[1]/usr/ssub%_SUBSCREEN_FREESEL:SAPLSSEL:1105/ctxt%%DYN001-LOW").Text = "000031945"
session.findById("wnd[1]/usr/ssub%_SUBSCREEN_FREESEL:SAPLSSEL:1105/ctxt%%DYN001-LOW").caretPosition = 9
session.findById("wnd[1]").sendVKey 0
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").currentCellColumn = ""
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell").selectedRows = "0"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell").pressContextButton "GOTO"
session.findById("wnd[0]/usr/cntlC_CONTAINER/shellcont/shell/shellcont[1]/shell/shellcont[0]/shell").selectMenuItem "DISPLAY_SOURCE"
Postado : 24/05/2026 12:32 pm