Skip to Content
0
Former Member
Apr 23, 2014 at 07:40 PM

Problem with SAP log-in using VBA with Excel Bexanalyzer add-in

444 Views

I am trying to login in to SAP using VBA code but the code fails as indicated below .

In Function GetBEx(Optional iWb As Workbook) As Object

GetBEx = pAddin.ExcelInterface.WorkbookBExExcelApplication(lName)

Works properly – I get an object

However, in the sapBEXgetConnection function it seems that the lBex.ComConnection fails. The p_connectionObj doesn’t get assigned (p_connectionObj is Nothing)

Function sapBEXgetConnection(Optional IWhat As Integer) As Variant

If IWhat = 0 Then

' try to get BexApi Connection

Dim lBEx As Object

Set lBEx = GetBEx

On Error Resume Next

Set p_connectionObj = lBEx.ComConnection 'fails here

If Err.Number <> 0 Then Set p_connectionObj = Nothing

On Error GoTo 0

If p_connectionObj Is Nothing Then If Not prepareConnection Then Exit Function

Set sapBEXgetConnection = p_connectionObj

End If

End Function

All of this code is part of the Bexanalyzer Excel Add-In

I’m assuming that I’m missing a patch or some configuration is incorrect but, since I’m not very familiar with SAP I don’t know. Any help would be greatly appreciated. Thank you.