<?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 DDE Calling Excel Macro with additional Parameters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DDE-Calling-Excel-Macro-with-additional-Parameters/m-p/725024#M225138</link>
    <description>&lt;P&gt;I am currently calling an&amp;nbsp;Excel Macro from withing SAS which works perfectly using DDE commands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;*execute the excel marco;
put "[run(""&amp;amp;excelMarcoName."")]";&lt;/PRE&gt;
&lt;P&gt;The Excel macro opens another excel file and saves it in a different location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ActiveWorkbook.SaveAs Filename:= _
        "C:\Users\testuser\src\reports\new_excel_file.xlsx"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently, the path of the file is hardcoded in the Excel Macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When calling the Excel Macro is it possible to include a parameter or additional argument that will contain the location of the directory into which the file should save?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That parameter would then be used inside the Excel Marco to determine where to save the new file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/154-31.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/154-31.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 02:22:01 GMT</pubDate>
    <dc:creator>arnouxvr</dc:creator>
    <dc:date>2021-03-10T02:22:01Z</dc:date>
    <item>
      <title>DDE Calling Excel Macro with additional Parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DDE-Calling-Excel-Macro-with-additional-Parameters/m-p/725024#M225138</link>
      <description>&lt;P&gt;I am currently calling an&amp;nbsp;Excel Macro from withing SAS which works perfectly using DDE commands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;*execute the excel marco;
put "[run(""&amp;amp;excelMarcoName."")]";&lt;/PRE&gt;
&lt;P&gt;The Excel macro opens another excel file and saves it in a different location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ActiveWorkbook.SaveAs Filename:= _
        "C:\Users\testuser\src\reports\new_excel_file.xlsx"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently, the path of the file is hardcoded in the Excel Macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When calling the Excel Macro is it possible to include a parameter or additional argument that will contain the location of the directory into which the file should save?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That parameter would then be used inside the Excel Marco to determine where to save the new file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/154-31.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/154-31.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 02:22:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DDE-Calling-Excel-Macro-with-additional-Parameters/m-p/725024#M225138</guid>
      <dc:creator>arnouxvr</dc:creator>
      <dc:date>2021-03-10T02:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: DDE Calling Excel Macro with additional Parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DDE-Calling-Excel-Macro-with-additional-Parameters/m-p/725866#M225542</link>
      <description>&lt;P&gt;I found &lt;A href="https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/229-2008.pdf" target="_self"&gt;this, in a SAS global forum paper&lt;/A&gt;.&amp;nbsp; Can you use these code snips to make it work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Put '[open("'"&amp;amp;dir"'\'"&amp;amp;&amp;amp;FileNm&amp;amp;i."'")]'; /* top of p.7 */

Data _NULL_;   /* bottom of p.6 */
 File sas2xl; 
 Put '[error(false)]'; 
 Put '[save.as("'"&amp;amp;dir"'\'"&amp;amp;Table."'")]'; 
Run; 
%MACRO I&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 18:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DDE-Calling-Excel-Macro-with-additional-Parameters/m-p/725866#M225542</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-03-12T18:38:55Z</dc:date>
    </item>
  </channel>
</rss>

