<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calling SAS through VBA in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/234168#M16938</link>
    <description>even i get this error. Do you have solution&lt;BR /&gt;&lt;BR /&gt;---------------------------&lt;BR /&gt;Microsoft Visual Basic for Applications&lt;BR /&gt;---------------------------&lt;BR /&gt;Run-time error '-2147467259 (80004005)':&lt;BR /&gt;&lt;BR /&gt;Automation error&lt;BR /&gt;Unspecified error &lt;BR /&gt;---------------------------&lt;BR /&gt;OK   Help   &lt;BR /&gt;---------------------------&lt;BR /&gt;</description>
    <pubDate>Wed, 11 Nov 2015 10:38:57 GMT</pubDate>
    <dc:creator>vps</dc:creator>
    <dc:date>2015-11-11T10:38:57Z</dc:date>
    <item>
      <title>Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79673#M7810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running SAS Enterprise Guide 5.1 on an external server and I want to call SAS commands through VBA.&lt;/P&gt;&lt;P&gt;I'm really not knowledgeable in this area so I tried to use a code I found (below). I sort of get what it's doing but clearly not enough.&lt;/P&gt;&lt;P&gt;When I run the code I get the error below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wondering if anyone has had any experience with this and any help/guidance would be much appreciated!&lt;/P&gt;&lt;P&gt;Also I have the SAS references ticked in VBA as well as Microsoft ActiveXData Objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Emre&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Run-time error '-2147213310 (80042002)';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;connectionAttempts&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;connectionAttempts&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sasserver&amp;gt;&amp;lt;/sasserver&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sasmachinednsname&amp;gt;&amp;lt;/sasmachinednsname&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sasport&amp;gt;0&amp;lt;/sasport&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;saslogin&amp;gt;&amp;lt;/saslogin&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;status&amp;gt;0x80040154&amp;lt;/status&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code&amp;nbsp; (highlighted is the problem code):&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim obWS As SAS.Workspace&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim obWSM As New SASWorkspaceManager.WorkspaceManager&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sub Form_Load()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim obConn As New ADODB.Connection&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim obRS As New ADODB.Recordset&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim errorString As String&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rem start the SAS session&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99cc00;"&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set obWS = obWSM.Workspaces.CreateWorkspaceByServer("My", _&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99cc00;"&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VisibilityProcess, Nothing, "", "", errorString)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rem submit some SAS code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obWS.LanguageService.Submit _&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff6600; font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "PROC IMPORT OUT=PATTERNS_NEW DATAFILE = ""\\Gblontfs01\test.xlsm"" DBMS = EXCELCS REPLACE; SHEET= Export; RUN; PROC APPEND BASE=EO.PATTERNS DATA=PATTERNS_NEW FORCE; RUN;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rem open an ADO connection to the data set&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim connString As String&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connString = "provider=sas.iomprovider.1; SAS Workspace ID=" _&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + obWS.UniqueIdentifier&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obConn.Open connString&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obRS.Open "work.a", obConn, adOpenStatic, adLockReadOnly, _&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adCmdTableDirect&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rem write the table as html (visible in Word with tags)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obRS.MoveFirst&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim sTable As String&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sTable = "&amp;lt;TABLE BORDER=0&amp;gt;&amp;lt;TBODY&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TD class="Data"&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Selection.TypeText sTable&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sTable = obRS.GetString(, , "&amp;lt;/TD&amp;gt;&amp;lt;TD class="Data"&amp;gt;", _&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TD class="Data"&amp;gt;")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Selection.TypeText sTable&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sTable = "&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;/TBODY&amp;gt;&amp;lt;/TABLE&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Selection.TypeText sTable&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rem tidy-up&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obRS.Close&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obConn.Close&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obWS.Close&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 11:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79673#M7810</guid>
      <dc:creator>feyzi</dc:creator>
      <dc:date>2013-03-18T11:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79674#M7811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have a VBA-ready example, but I do have some examples in Windows PowerShell.&amp;nbsp; The syntax is different, but the same objects are used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest using SAS Object Manager (instead of Workspace Manager, which is a bit older and supported only as legacy).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this post:&lt;/P&gt;&lt;P&gt;&lt;A href="http://blogs.sas.com/content/sasdummy/2013/03/13/using-powershell-with-sas-workspace/" title="http://blogs.sas.com/content/sasdummy/2013/03/13/using-powershell-with-sas-workspace/"&gt; Using Windows PowerShell to connect to a SAS Workspace server - The SAS Dummy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And also this sasCommunity page:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Create_Your_Own_Client_Apps_Using_SAS_Integration_Technologies" title="http://www.sascommunity.org/wiki/Create_Your_Own_Client_Apps_Using_SAS_Integration_Technologies"&gt;http://www.sascommunity.org/wiki/Create_Your_Own_Client_Apps_Using_SAS_Integration_Technologies&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 12:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79674#M7811</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2013-03-18T12:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79675#M7812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you said you run EG and SAS on a remote server. So i guess that you don't have a local SAS installation.&lt;/P&gt;&lt;P&gt;When you call the function CreateWorkspaceByServer you should pass a reference to a ServerDef object as the third parameter. In this ServerDef object you define where your remote SAS Server is located (DNS-name, port, protocoll, ...).&lt;/P&gt;&lt;P&gt;You can retrieve most of that information that you need for the connection from the Enterprise Guide "Server List" by right clicking the server and selecting the context menu "properties".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way: &lt;STRONG&gt;can somebody at SAS please update the SAS/IT Client documentation?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I was not aware that the Workspace Manager was deprecated and seen as legacy. I just wasted half a day yesterday with some weird COM Exceptions when i tried to create a ServerDef object in a 64bit environment...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 09:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79675#M7812</guid>
      <dc:creator>AndreasMenrath</dc:creator>
      <dc:date>2013-03-19T09:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79676#M7813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Andreas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I find problems in the documentation, I submit them to tech. support. Up till now, they've accepted them with good grace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Mar 2013 16:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79676#M7813</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2013-03-19T16:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79677#M7814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much for the help and sorry for the late reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying this code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Form_Load()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dim obObjectFactory As New SASObjectManager.ObjectFactory&lt;/P&gt;&lt;P&gt;Dim obObjectKeeper As New SASObjectManager.ObjectKeeper&lt;/P&gt;&lt;P&gt;Dim obServer As New SASObjectManager.ServerDef&lt;/P&gt;&lt;P&gt;Dim obSAS As SAS.Workspace&lt;/P&gt;&lt;P&gt;Dim cn As New ADODB.Connection&lt;/P&gt;&lt;P&gt;Dim rs As New ADODB.Recordset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;obServer.MachineDNSName = "GBLONTAS68"&lt;/P&gt;&lt;P&gt;obServer.Protocol = SASObjectManager.Protocols.ProtocolBridge&lt;/P&gt;&lt;P&gt;obServer.Port = 8561&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;obObjectFactory.LogEnabled = True&lt;/P&gt;&lt;P&gt;Set obSAS = obObjectFactory.CreateObjectByServer("sas", True, obServer, "myusername", "mypassword")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;obSAS.LanguageService.Submit ("DATA EO.VBATEST; SET EO.FX; RUN;")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...and getting this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="3275" alt="VBA ERROR.JPG" class="jive-image" src="https://communities.sas.com/legacyfs/online/3275_VBA ERROR.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="3272" alt="server.JPG" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/3272_server.JPG" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts on how I can solve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you ever so much again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Mar 2013 15:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79677#M7814</guid>
      <dc:creator>feyzi</dc:creator>
      <dc:date>2013-03-22T15:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79678#M7815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well the message says everything: you are connecting to the metadata server and not the workspaceserver.&lt;/P&gt;&lt;P&gt;The workspaceservers default port is 8591.&lt;/P&gt;&lt;P&gt;Perhaps the workspaceserver also runs on a different machine. Connect to your profile, go to the serverlist, locate the server you want to connect to and right click the context menu "properties" to see the right connection profile for your workspaceserver.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW: if you are using IWA (integrated windows authentication) you must not provide a username and password.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i suggest this code:&lt;/P&gt;&lt;P&gt;obServer.MachineDNSName = "GBLONTAS68"&lt;/P&gt;&lt;P&gt;obServer.Protocol = SASObjectManager.Protocols.ProtocolBridge&lt;/P&gt;&lt;P&gt;obServer.Port = &lt;STRONG&gt;8591&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set obSAS = obObjectFactory.CreateObjectByServer("sas", True, obServer,&lt;STRONG&gt; Nothing, Nothing&lt;/STRONG&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 09:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79678#M7815</guid>
      <dc:creator>AndreasMenrath</dc:creator>
      <dc:date>2013-03-25T09:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79679#M7816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks very much guys. Works perfectly!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 11:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/79679#M7816</guid>
      <dc:creator>feyzi</dc:creator>
      <dc:date>2013-03-25T11:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/229221#M16692</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am newbie in SAS. I am trying to run a sas code via VBA after setting up SAS Reference in VBA. However i am getting an error massage "Active X component Cann't create &amp;nbsp;object". please note i am using BASE SAS 9.3 and windows 7- 64 bit and excel 64 bit too.&lt;/P&gt;&lt;P&gt;for me its seems like, VBA is unable to communicate with SAS and its unable to create a workspace object at first place.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried my best but didn't get any concrete answer through google. Expert please advise and help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance for giving your valuable time to look into this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 05:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/229221#M16692</guid>
      <dc:creator>analystritesh</dc:creator>
      <dc:date>2015-10-09T05:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/229263#M16693</link>
      <description>&lt;P&gt;Please post your question as a new one.&amp;nbsp; This one was marked 'answered' so many people won't look at it further.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 12:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/229263#M16693</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2015-10-09T12:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/233772#M16925</link>
      <description>Can you guide me. Its not working for me. I am getting Automation error&lt;BR /&gt;&lt;BR /&gt;---------------------------&lt;BR /&gt;Microsoft Visual Basic for Applications&lt;BR /&gt;---------------------------&lt;BR /&gt;Run-time error '-2147213310 (80042002)':&lt;BR /&gt;&lt;BR /&gt;Automation error&lt;BR /&gt;---------------------------&lt;BR /&gt;OK   Help   &lt;BR /&gt;---------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Nov 2015 05:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/233772#M16925</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-09T05:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/233775#M16926</link>
      <description>Hi feyzi - &lt;BR /&gt;Can you help me with sample code. i am not able to get this. getting an auotmation error&lt;BR /&gt;&lt;BR /&gt;---------------------------&lt;BR /&gt;Microsoft Visual Basic for Applications&lt;BR /&gt;---------------------------&lt;BR /&gt;Run-time error '-2147213310 (80042002)':&lt;BR /&gt;&lt;BR /&gt;Automation error&lt;BR /&gt;---------------------------&lt;BR /&gt;OK   Help   &lt;BR /&gt;---------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Nov 2015 05:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/233775#M16926</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-09T05:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/234168#M16938</link>
      <description>even i get this error. Do you have solution&lt;BR /&gt;&lt;BR /&gt;---------------------------&lt;BR /&gt;Microsoft Visual Basic for Applications&lt;BR /&gt;---------------------------&lt;BR /&gt;Run-time error '-2147467259 (80004005)':&lt;BR /&gt;&lt;BR /&gt;Automation error&lt;BR /&gt;Unspecified error &lt;BR /&gt;---------------------------&lt;BR /&gt;OK   Help   &lt;BR /&gt;---------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Nov 2015 10:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/234168#M16938</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-11T10:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/234175#M16939</link>
      <description>The error codes that you've shared are COM errors: caused when VBA cannot properly use the components that you've referenced.&lt;BR /&gt;&lt;BR /&gt;I suggest that you either create a new topic and supply the code you are trying to use, plus some details of your installation -- or perhaps work with SAS Technical Support to see what's going on with your setup.&lt;BR /&gt;&lt;BR /&gt;This topic already has a solution, so this isn't the best place to post your query.</description>
      <pubDate>Wed, 11 Nov 2015 13:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/234175#M16939</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2015-11-11T13:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/234327#M16940</link>
      <description>Chris - &lt;BR /&gt;Thanks for the feedback. Can you suggest me a solved post., where can I refer this. Let me explain you again what I am trying to - &lt;BR /&gt;I want to build a connection using VBA and get data in to spreadsheet. The SAS is present in one of my server and I will be executing the macro on my local. Above was the code what I have mentioned. The error is prompted only when I try to open the recordset connecion.&lt;BR /&gt;&lt;BR /&gt;Cheers</description>
      <pubDate>Thu, 12 Nov 2015 05:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/234327#M16940</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-12T05:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calling SAS through VBA</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/236524#M17059</link>
      <description>Can you guide me how to execute block of code or say doing joins ?</description>
      <pubDate>Thu, 26 Nov 2015 07:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Calling-SAS-through-VBA/m-p/236524#M17059</guid>
      <dc:creator>vps</dc:creator>
      <dc:date>2015-11-26T07:08:33Z</dc:date>
    </item>
  </channel>
</rss>

