我有下面的代码,我用来从SAP导出PDF。它在以前的SAP版本上工作,但是现在它在Browserhandle.locationURL上得到了“运行时错误438,object不支持这个属性或方法”。
你能给我个提示吗?我该换什么?
Call SAPopen(SystemName, SystemID, TransID)
session.findById("wnd[0]").maximize
For i = 6 To lastInv
invRef = Cells(i, 2)
invName = Cells(i, 3)
fileName = fPath & invName & ".pdf"
If FileExists(fileName) = True Then fileName = fPath & invName & "i" & ".pdf"
session.findById("wnd[0]/usr/ctxtVBRK-VBELN").Text = invRef
session.findById("wnd[0]/mbar/menu[0]/menu[11]").Select
If session.ActiveWindow.Name = "wnd[0]" Then
Message = "No output exists"
GoTo WriteMsg
End If
session.findById("wnd[1]/usr/tblSAPLVMSGTABCONTROL").getAbsoluteRow(0).Selected = True
session.findById("wnd[1]/tbar[0]/btn[37]").press
If session.ActiveWindow.Name = "wnd[1]" Then
Message = "No output could be opened"
GoTo WriteMsg
End If
session.findById("wnd[0]/tbar[0]/okcd").Text = "pdf!"
session.findById("wnd[0]").sendVKey 0
pdfLocL = session.findById("wnd[1]/usr/cntlHTML/shellcont/shell").Browserhandle.locationURL
pdfLocStart = InStr(pdfLocL, "C:")
pdfLocS = Mid(pdfLocL, pdfLocStart, 9999)
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.copyfile pdfLocS, fileName
If FileExists(fileName) = True Then Message = "Invoice saved" Else Message = "Invoice not saved"
session.findById("wnd[1]").Close
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[1]").Close
Set FSO = Nothing发布于 2022-07-26 11:41:31
通过将浏览器控件更改为解决问题。
https://stackoverflow.com/questions/73121870
复制相似问题