Conflict between SAP and Microsoft Outlook Reference 15.0 Object Library in Macro Excel VBA

0

I have a conflict in my macro, when I added the Microsoft Outlook 15.0 Object Library reference in VBA, all other SAP related macros do not work in the line of access code to the transaction.

Does anyone know what can be due?

This is the code I'm using:

'Rutina de inicio, llama a SAP
 If Not IsObject(Appli) Then
    Set SapGuiAuto = GetObject("SAPGUI")
    Set Appli = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
    Set Connection = Appli.Children(0)
End If
If Not IsObject(session) Then
    Set session = Connection.Children(0)
End If
'Elegimos la transación esta es la línea donde me da el ERROR
session.findById("wnd[0]/tbar[0]/okcd").Text = "ME5A"

The error I receive is:

  

Run-time error '438': The object does not support this property or method.

    
asked by Pablo Domenech 24.10.2016 в 13:40
source

1 answer

0

One of the reasons why you may be failing is that the name of the variables could conflict with other VBA variables in Outlook.

My suggestion:

 Set SapGuiAuto = GetObject("SAPGUI")
 Set Appli = SapGuiAuto.GetScriptingEngine
 Set SAPConnection = Appli.Children(0)
 Set SAPsession = SAPConnection.Children(0)
 SAPsession.findById("wnd[0]/tbar[0]/okcd").Text = "ME5A"
    
answered by 25.10.2016 / 11:59
source