SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

Connecting to SAS fomr Excel/VBA

Posts: 1

Connecting to SAS fomr Excel/VBA

Hi there,

we have a bunch of Excel/VBA-programs to do our reporting.

Our data we select from a SQL-DB.

Now we changed our DB to SAS.

I'm now trying to connect to SAS to use the reporting as it is, but the connection doesn't work.

I use the following code to build up a connection to SAS.

    Dim obObjectFactory As New SASObjectManager.ObjectFactory

    Dim obServer As New SASObjectManager.ServerDef

    Dim sasWS As sas.Workspace


    obServer.MachineDNSName = "lcub1sa"

    obServer.Protocol = SASObjectManager.Protocols.ProtocolBridge

    obServer.Port = 18561


    Set sasWS = obObjectFactory.CreateObjectByServer("My_Prod_Data", True, obServer, "myusername", "mypassword")

When running this code i get an exception

"SASMessage severity = "Error" : The client has connected to a SAS (9.2) Metadata Server (v1.0) when it intended to connect to a SAS Workspace Server."

Any ideas to avoid this exception and to set up a valid connection are wellcome.


Achim Müller

Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation