<?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 Run SAS code in Excel VBA macro via SAS AMO? in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Run-SAS-code-in-Excel-VBA-macro-via-SAS-AMO/m-p/508945#M2311</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering whether it is possible to leverage the SAS Add-in for Excel to run "raw" SAS code directly from VBA?&amp;nbsp; For example, I would like to have a VBA macro like the following (which references a hypothetical SubmitCode method):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub foo()
    Dim sas As SASExcelAddIn
    Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
    sas.SubmitCode "%let foo=bar;"
End Sub&lt;/PRE&gt;&lt;P&gt;I'm not finding any method within the AMO documentation that would perform the role of that hypothetical SubmitCode method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm aware that running code in this way is doable using the SAS OLE automation object (&lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n11qaawfl1x9d6n1p3omjbc9ogi0.htm" target="_self"&gt;http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n11qaawfl1x9d6n1p3omjbc9ogi0.htm&lt;/A&gt;), but I would prefer to stick with AMO since I already have other code using AMO and would like to have the same SAS workspace "behind the scenes", in order to have the same work library throughout the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jake&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Oct 2018 21:44:26 GMT</pubDate>
    <dc:creator>JRoman</dc:creator>
    <dc:date>2018-10-30T21:44:26Z</dc:date>
    <item>
      <title>Run SAS code in Excel VBA macro via SAS AMO?</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Run-SAS-code-in-Excel-VBA-macro-via-SAS-AMO/m-p/508945#M2311</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering whether it is possible to leverage the SAS Add-in for Excel to run "raw" SAS code directly from VBA?&amp;nbsp; For example, I would like to have a VBA macro like the following (which references a hypothetical SubmitCode method):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub foo()
    Dim sas As SASExcelAddIn
    Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
    sas.SubmitCode "%let foo=bar;"
End Sub&lt;/PRE&gt;&lt;P&gt;I'm not finding any method within the AMO documentation that would perform the role of that hypothetical SubmitCode method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm aware that running code in this way is doable using the SAS OLE automation object (&lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n11qaawfl1x9d6n1p3omjbc9ogi0.htm" target="_self"&gt;http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n11qaawfl1x9d6n1p3omjbc9ogi0.htm&lt;/A&gt;), but I would prefer to stick with AMO since I already have other code using AMO and would like to have the same SAS workspace "behind the scenes", in order to have the same work library throughout the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jake&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 21:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Run-SAS-code-in-Excel-VBA-macro-via-SAS-AMO/m-p/508945#M2311</guid>
      <dc:creator>JRoman</dc:creator>
      <dc:date>2018-10-30T21:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Run SAS code in Excel VBA macro via SAS AMO?</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Run-SAS-code-in-Excel-VBA-macro-via-SAS-AMO/m-p/597484#M2440</link>
      <description>you could pass the SAS code to a stored process and run it that way.</description>
      <pubDate>Thu, 17 Oct 2019 19:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Run-SAS-code-in-Excel-VBA-macro-via-SAS-AMO/m-p/597484#M2440</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-10-17T19:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Run SAS code in Excel VBA macro via SAS AMO?</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Run-SAS-code-in-Excel-VBA-macro-via-SAS-AMO/m-p/601517#M2450</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no method to run the code directly in the VBA.&lt;/P&gt;
&lt;P&gt;However, if you have already defined&amp;nbsp;the SAS Program, executed it in the SAS Add-in and you have results in the workbook,&amp;nbsp; you could save the workbook, and use the &lt;STRONG&gt;Refresh&lt;/STRONG&gt; method to refresh the workbook or a sheet in the workbook that contains the location of the code results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the first suggestion of placing your code in a stored process and executing the store process from the VBA would be a good solution to this question.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 21:24:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Run-SAS-code-in-Excel-VBA-macro-via-SAS-AMO/m-p/601517#M2450</guid>
      <dc:creator>KatS_SAS</dc:creator>
      <dc:date>2019-11-04T21:24:14Z</dc:date>
    </item>
  </channel>
</rss>

