Bonjour,
Je pense avoir une idée pour résoudre le problème mais rien de certain,
Essayer cela:
Sub Connexion_SAP()
Application.DisplayAlerts = False
Dim Appl As Object
Dim Connection As Object
Dim session As Object
Dim WshShell As Object
Dim SapGui As Object
Shell "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe", 4
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 Appl = SapGui.GetScriptingEngine
Set Connection = Appl.Openconnection("PLP", True) 'modifier si le nom du système change
Set session = Connection.Children(0)
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "200"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "Identifiant"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "Mdp"
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 0
If session.Children.Count > 1 Then
answer = MsgBox("Sap est déjà ouvert, merci de le fermer !" & _
"S'il vous plaît partez et réessayez", vbCritical, "Ouverture SAP")
session.findById("wnd[1]/usr/radMULTI_LOGON_OPT3").Select
session.findById("wnd[1]/usr/radMULTI_LOGON_OPT3").SetFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
Exit Sub
End If
End Sub
Si cela ne fonctionne pas:
Aller sur la page de connexion faite "ALT-F12" puis "Enregistrement et Playback de Script..."
Vous devrez rentrer le "Mandant", "Utilisateur", "Mot passe" et "Langue de travail" manuellement puis appuyer sur entrée
Après cela vous pourrez stopper l’enregistrement du script et l'ouvrir avec le bloc note,
A partir de là si vous pourrez envoyer le contenu du bloc note (anonymiser bien sur )