Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Connecting SAP.BAPI in VBA - Connection Problem

Former Member
0 Kudos

Hi there,

I'm trying to develop some code to let an access database (2010) I'm working on pull data from SAP. I've been working through all the coding examples on the web, I even have a nice big book full of even more wonderful examples, but I seem to be suck just past the starting blocks.

I can sucessfully connect to SAP using the SAP.LogonControl, and end up creating a valid connection called msapConn.


returns 1, and I can query things like .System and .ApplicationServer and get valid responses.

I then go on to define a msapBapi object as:

set msapBapi = CreateObject("SAP.BAPI.1")

to which all of the coding examples I have read say I should be able to define:

set msapBapi.Connection = msapConn

But all I get is a "Bad variant type" error.

Anyone able to point me in the right direction?

(P.S. I have wdobapi.ocx and wdtlog.ocx as references for the project)


Former Member
0 Kudos

did you get this resolved --- im getting the same error.

0 Kudos

I am getting "Bad variant type", too.