我有这个子调用执行其他两个子在程序中,但当我试图执行它弹出编译错误:语法错误就在子的第一行。
Sub MacroPrimaria()
Call SAPOpenSessionFromLogon
Application.Wait Now + TimeValue("00:00:05")
Call executarsap
MsgBox ("PROCESSAMENTO FINALIZADO")
End Sub
Sub SAPOpenSessionFromLogon()
Dim SapGui
Dim Applic
Dim connection
Dim session
Dim WSHShell
Shell "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe", vbNormalFocus
Set WSHShell = CreateObject("WScript.Shell")
Do Until WSHShell.AppActivate("SAP Logon ")
Application.Wait Now + TimeValue("0:00:01")
Loop
Set WSHShell = Nothing
Set SapGui = GetObject("SAPGUI")
Set Applic = SapGui.GetScriptingEngine
Set connection = Applic.OpenConnection("S/4 HANA - PRODUÇÃO", True)
Set session = connection.Children(0)
session.findById("wnd[0]").maximize
End Sub
Sub executarsap()
Dim Application, SapGuiAuto, connection, session, WScrip
'**IMPORTANTE**: Abaixo daqui, basta colar o scrip gerado pela gravação do SAP, sem retirar nada:
'This sub it's okay and has confidential stuff so its just to know.
End Sub
我被这个错误卡住了:
一个三个三个一个
我希望能够执行这个宏
1条答案
按热度按时间juud5qan1#
你的代码没有给我一个编译错误。
这是我用来与SAP交互的代码,到目前为止它还没有给我带来任何问题(虽然不记得我在互联网上找到它的地方)。
可能会有帮助。