BookmarkSubscribeRSS Feed
Calcite | Level 5

I'm trying to open up SAS Enterprise from VBA to call upon/run a different program. But I'm getting an error "2147213310 (80042002)" which I'm confused about (I've attached the exact error message).


This is the first time I've tried to connect from VBA to SAS so everything I have so far has been picked from codes I've found in other forums.


    Dim obObjectFactory As New SASObjectManager.ObjectFactory
    Dim obObjectKeeper As New SASObjectManager.ObjectKeeper
    Dim obServer As New SASObjectManager.ServerDef
    Dim obSAS As SAS.Workspace
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    obServer.MachineDNSName = "DummyName"
    obServer.Protocol = ProtocolBridge
    obServer.Port = 8591
    obObjectFactory.LogEnabled = True
    Set obSAS = obObjectFactory.CreateObjectByServer("My Server", True, obServer, "MyUserName", "MyPassword")


The error is when I run the last line.


The SAS Profile I'm trying to connect to has been attached too.


I have seen some stuff around about issues running on 32-bit SAS but I have no idea how to get around this?

Has anyone come across this issue before?


Thank you,

Community Manager

The code you shared is for connecting to SAS directly with Integration Technologies. But your screenshots show that you have SAS Enterprise Guide or the SAS Add-In for Microsoft Office.


If you have the SAS Add-In for Microsoft Office, start with this paper to learn about VBA and scripting.   Here's a broader, more recent paper from the same expert.


If you have SAS Enterprise Guide, then start with this article about EG Automation.


If you want to connect to SAS directly and bypass SAS Enterprise Guide and the SAS Add-In for Microsoft Office (though that is more work so I recommend scripting through one of the clients instead), check out this article and code samples on GitHub.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.


Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation