I have SAS EG version 7.1 and Office 2013 Installed on my system. I am trying to run my SAS projects by calling them from VBA. As a first step, I tried to call a simple PROC step using the below code I found online:
Sub createTable()
Dim obObjectFactory As New SASObjectManager.ObjectFactory
Dim obObjectKeeper As New SASObjectManager.ObjectKeeper
Dim obServer As New SASObjectManager.ServerDef
Dim obSAS as SAS.workspace
Dim query as String
query = "PROC SQL; CREATE TABLE ME.TABLE1; RUN;"
obServer.MachineDNSName = "XXXXXXXXX"
obServer.Protocol = ProtocolBridge
obServer.Port = 8561
obObjectFactory.LogEnabled = True
Set obSAS = obObjectFactory.CreateObjectByServer("SASApp", True, obServer, "", "")
obSAS.LanguageService.Submit query
End Sub
But I'm getting an error at below line:
Set obSAS = obObjectFactory.CreateObjectByServer("SASApp", True, obServer, "", "")
![3275_VBA ERROR.JPG 3275_VBA ERROR.JPG](https://communities.sas.com/t5/image/serverpage/image-id/19602i8EB57BBB45415FEF/image-size/large?v=v2&px=999)
Can anyone please help me to move forward this error? Also, any guidance to run the SAS projects is greatly appreciated. I am new to both VBA and SAS.