<?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 Excel Macro to run multiple SAS egp in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Run-Excel-Macro-to-run-multiple-SAS-egp/m-p/535818#M6540</link>
    <description>Dear All, I am trying to create a macro to run multiple SAS .egp programs from Excel. (I am stack 2 days now) I managed to write a code to run one .egp program but if I run the macro again second time before I close the Excel workbook I get a run time error: "Run-time error '-2146233088 (80131500)': Path is not a directory 'C:': The filename, directory name, or volume label syntax is incorrect." This is very strange since I am not working on C: drive. Please see below the excel macro which crashes the second time I run it at line: Set Proj = ApplicationObj.Open(Path &amp;amp; "SAS1.egp", "") Sub RunFor() Dim ApplicationObj As Object 'Application Dim Proj As Object 'Project object Dim sasProgram As Object 'Code object (SAS program) Dim log1 As String Dim parmList As Variant Dim parm As Variant Dim Path As String Dim Full_Date As Variant Path = "M:\REPORT TO UNIT\KPIs_reports\Run SAS from Excel tests\" Worksheets("KPIs").Activate Full_Date = Cells(9, "C").Value 'On Error GoTo ErrHandler Set ApplicationObj = CreateObject("SASEGObjectModel.Application.7.1") Set Proj = ApplicationObj.Open(Path &amp;amp; "SAS1.egp", "") 'Set Proj = ApplicationObj.Open(Path &amp;amp; "SAS1.egp", "") Set parmList = Proj.Parameters MsgBox "Project has " &amp;amp; parmList.Count &amp;amp; " parameters." Set parm = parmList.Item(0) 'MsgBox parm.Name &amp;amp; " parameter has default value of " &amp;amp; parm.DefaultValue MsgBox parm.Name &amp;amp; " parameter" parm.Value = Full_Date MsgBox parm.Name &amp;amp; " parameter has been set to value of " &amp;amp; parm.Value Proj.Run 'Set Proj = Nothing 'Set ApplicationObj = Nothing Proj.SaveAs "M:\REPORT TO UNIT\KPIs_reports\Run SAS from Excel tests\SAS1.egp" Proj.Close ApplicationObj.Quit ''''''''&amp;amp;Preivous_Date ,is the prompt in SAS ActiveWorkbook.RefreshAll End End Sub Please let me know your thoughts. Thanks in advance.</description>
    <pubDate>Fri, 15 Feb 2019 09:51:52 GMT</pubDate>
    <dc:creator>konnos</dc:creator>
    <dc:date>2019-02-15T09:51:52Z</dc:date>
    <item>
      <title>Run Excel Macro to run multiple SAS egp</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Run-Excel-Macro-to-run-multiple-SAS-egp/m-p/535818#M6540</link>
      <description>Dear All, I am trying to create a macro to run multiple SAS .egp programs from Excel. (I am stack 2 days now) I managed to write a code to run one .egp program but if I run the macro again second time before I close the Excel workbook I get a run time error: "Run-time error '-2146233088 (80131500)': Path is not a directory 'C:': The filename, directory name, or volume label syntax is incorrect." This is very strange since I am not working on C: drive. Please see below the excel macro which crashes the second time I run it at line: Set Proj = ApplicationObj.Open(Path &amp;amp; "SAS1.egp", "") Sub RunFor() Dim ApplicationObj As Object 'Application Dim Proj As Object 'Project object Dim sasProgram As Object 'Code object (SAS program) Dim log1 As String Dim parmList As Variant Dim parm As Variant Dim Path As String Dim Full_Date As Variant Path = "M:\REPORT TO UNIT\KPIs_reports\Run SAS from Excel tests\" Worksheets("KPIs").Activate Full_Date = Cells(9, "C").Value 'On Error GoTo ErrHandler Set ApplicationObj = CreateObject("SASEGObjectModel.Application.7.1") Set Proj = ApplicationObj.Open(Path &amp;amp; "SAS1.egp", "") 'Set Proj = ApplicationObj.Open(Path &amp;amp; "SAS1.egp", "") Set parmList = Proj.Parameters MsgBox "Project has " &amp;amp; parmList.Count &amp;amp; " parameters." Set parm = parmList.Item(0) 'MsgBox parm.Name &amp;amp; " parameter has default value of " &amp;amp; parm.DefaultValue MsgBox parm.Name &amp;amp; " parameter" parm.Value = Full_Date MsgBox parm.Name &amp;amp; " parameter has been set to value of " &amp;amp; parm.Value Proj.Run 'Set Proj = Nothing 'Set ApplicationObj = Nothing Proj.SaveAs "M:\REPORT TO UNIT\KPIs_reports\Run SAS from Excel tests\SAS1.egp" Proj.Close ApplicationObj.Quit ''''''''&amp;amp;Preivous_Date ,is the prompt in SAS ActiveWorkbook.RefreshAll End End Sub Please let me know your thoughts. Thanks in advance.</description>
      <pubDate>Fri, 15 Feb 2019 09:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Run-Excel-Macro-to-run-multiple-SAS-egp/m-p/535818#M6540</guid>
      <dc:creator>konnos</dc:creator>
      <dc:date>2019-02-15T09:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Run Excel Macro to run multiple SAS egp</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Run-Excel-Macro-to-run-multiple-SAS-egp/m-p/536158#M6588</link>
      <description>&lt;P&gt;Please post you questions and code in a readable format.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/help/faqpage/faq-category-id/posting#posting" target="_blank"&gt;https://communities.sas.com/t5/help/faqpage/faq-category-id/posting#posting&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maxims of Maximally Efficient SAS Programmers&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;How to convert datasets to data steps&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The macro for direct download&lt;BR /&gt;&lt;A href="https://gist.githubusercontent.com/statgeek/bcc55940dd825a13b9c8ca40a904cba9/raw/865d2cf18f5150b8e887218dde0fc3951d0ff15b/data2datastep.sas" target="_blank"&gt;https://gist.githubusercontent.com/statgeek/bcc55940dd825a13b9c8ca40a904cba9/raw/865d2cf18f5150b8e887218dde0fc3951d0ff15b/data2datastep.sas&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Feb 2019 14:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Run-Excel-Macro-to-run-multiple-SAS-egp/m-p/536158#M6588</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-02-16T14:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Run Excel Macro to run multiple SAS egp</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Run-Excel-Macro-to-run-multiple-SAS-egp/m-p/536733#M6657</link>
      <description>{Hi VDD, Thanks for the reply. I am trying to find how to format my post but I do not have the options as mentioned in your first link in section "How can I add SAS syntax to a post?" I am using Internet Explorer, is that is issue? Thanks}</description>
      <pubDate>Tue, 19 Feb 2019 14:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Run-Excel-Macro-to-run-multiple-SAS-egp/m-p/536733#M6657</guid>
      <dc:creator>konnos</dc:creator>
      <dc:date>2019-02-19T14:27:54Z</dc:date>
    </item>
  </channel>
</rss>

