BookmarkSubscribeRSS Feed
TiteJoe
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,

1 REPLY 1
ChrisHemedinger
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.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 719 views
  • 2 likes
  • 2 in conversation