ScriptMan,
I have removed the workaround and tested your code.
Unfortunately, SAP seems to interrupt the code after the highlighted line, and it waits until I manually close the "import file" dialog.
-----------------------------------------------------------------
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.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 application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/niw33"
session.findById("wnd[0]").sendVKey 0
OrdNum = "2013584402"
set Wshell = CreateObject("WScript.Shell")
session.findById("wnd[0]/usr/ctxtCAUFVD-AUFNR").text = OrdNum
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/titl/shellcont/shell").pressButton "%GOS_TOOLBOX"
session.findById("wnd[0]/shellcont/shell").pressContextButton "CREATE_ATTA"
session.findById("wnd[0]/shellcont/shell").selectContextMenuItem "PCATTA_CREA"
session.findById("wnd[1]/usr/ctxtDY_PATH").text = ""
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "C:\Users\u32q\Desktop\teste anexo ordem.txt"
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/shellcont").close
-----------------------------------------------------------------
If i manually chose the "import file" dialog, the next line is executed, but it fails because SAP won't locate session.findById("wnd[1]/usr/ctxtDY_PATH").
I have also tried to enable/disable the box "show native windows dialog" in the scripting options, no success either.