I want to get the file name from an attachment inside a Purchase Requisition in SAP using VBA.
I have tried already changing the last line for some random numbers bu nothing happened and I can't manage to discover where I can get the file name.
session.findByid("wnd[0]/usr/subSUB0:SAPLMEGUI:0010/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:3212/cntlGRIDCONTROL/shellcont/shell").pressToolbarButton "&MEREQDMS"
'here my code tells me if there are any attachment in purchase requisition item
doc = session.findByid("wnd[1]/usr/tblSAPLCVOBTCTRL_DOKUMENTE/ctxtDRAW-DOKNR[1,0]").Text
'starts on item line (0)
n = 0
Do While doc <> ""
session.findByid("wnd[1]/usr/tblSAPLCVOBTCTRL_DOKUMENTE/ctxtDRAW-DOKNR[1," & n & "]").SetFocus
session.findByid("wnd[1]/usr/tblSAPLCVOBTCTRL_DOKUMENTE/ctxtDRAW-DOKNR[1," & n & "]").caretPosition = 5
'opens the attachment page with the documents inside for download
session.findByid("wnd[1]").sendVKey 2
Application.AutomationSecurity = msoAutomationSecurityForceDisable
Application.AutomationSecurity = msoAutomationSecurityByUI
q = 1
s = 0
'num_files returns me "PDF" or "XLS".
num_files = session.findByid("wnd[0]/usr/tabsTAB_MAIN/tabpTSMAIN/ssubSCR_MAIN:SAPLCV110:0102/cntlCTL_FILES1/shellcont/shell/shellcont[1]/shell").getnodetextbypath(q)
...
Here is the file with file name I need VBA tells me ("Escopo Plataforma..."):