<?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 VBS using SAS variables in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/306723#M1927</link>
    <description>&lt;P&gt;Dear all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you, please, help me with the problem?&lt;/P&gt;&lt;P&gt;I have a VBscript that is automatically run via MS scheduler. It runs a .EGP project (SAS enterprise guide 5.1), than goes to Excel, refreshes it and save it as of a specific date like this: "C:\Users\USER123\Desktop\CAP_&lt;STRONG&gt;2014_10_20&lt;/STRONG&gt;.xlsx". This date takes place in SAS as a variable&amp;nbsp;that is set as "&lt;SPAN&gt;prev_bd".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;So, what I need&lt;/U&gt;: can VBscript somehow take the value of this variable from SAS and use it further?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VBscript consists of 2 parts:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1) Standard code LAUNCHING, RUNNING and SAVING SAS.&lt;/STRONG&gt;&lt;/U&gt; I shall not display it for it is too common;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2) LAUNCHING, REFRESHING AND SAVING EXCEL:&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;Public Excelapp , ExcelFile ,Sam_Refresh ,Sam_Refresh_Sheet ,ExcelSheet, strLast_BD&lt;/P&gt;&lt;P&gt;Set Excelapp = CreateObject("Excel.Application")&lt;BR /&gt;Set ExcelFile = Excelapp.Workbooks.Open("&lt;SPAN&gt;C:\Users\&lt;/SPAN&gt;&lt;SPAN&gt;USER123&lt;/SPAN&gt;&lt;SPAN&gt;\Desktop\CAP_&lt;/SPAN&gt;Template&lt;SPAN&gt;.xlsx&lt;/SPAN&gt;")&lt;BR /&gt;Set Sam_Refresh = Excelapp.Workbooks.Open("&lt;SPAN&gt;C:\Users\&lt;/SPAN&gt;&lt;SPAN&gt;USER123&lt;/SPAN&gt;&lt;SPAN&gt;\Desktop\&lt;/SPAN&gt;SAM_refresh.xlsm") &amp;nbsp; &amp;nbsp;' I have to go to this file and extract&amp;nbsp;&lt;SPAN&gt;strLast_BD (same value as&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;prev_bd" from SAS).&lt;/SPAN&gt;&lt;BR /&gt;Set Sam_Refresh_Sheet = Sam_Refresh.Sheets(1)&lt;BR /&gt;Set ExcelSheet = ExcelFile.Sheets(1)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Excelapp.DisplayAlerts = False&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sam_Refresh.RefreshAll&lt;BR /&gt;With Sam_Refresh_Sheet&lt;BR /&gt;set strLast_BD= .Range ("C4")&lt;BR /&gt;end with&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;With ExcelFile&lt;BR /&gt;.RefreshAll&lt;BR /&gt;.SaveAs _&lt;BR /&gt;"" &amp;amp; ExcelFile.Path &amp;amp; "" &amp;amp; _&lt;BR /&gt;"\" &amp;amp; Left(Left(ExcelFile.Name, (InStrRev(ExcelFile.Name, ".", -1, vbTextCompare) - 1)), (InStrRev(ExcelFile.Name, "_", -1, vbTextCompare) - 9)) &amp;amp; "" &amp;amp; _&lt;BR /&gt;"_" &amp;amp; &lt;STRONG&gt;strLast_BD&lt;/STRONG&gt; &amp;amp; ".xlsx", 51&lt;BR /&gt;end with&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;with Excelapp&lt;BR /&gt;.DisplayAlerts = False&lt;BR /&gt;.save&lt;BR /&gt;.Quit&lt;BR /&gt;end with&lt;/P&gt;&lt;P&gt;Excelapp.quit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In case you need SAS code or something else I would be glad to share it with you!&lt;/P&gt;</description>
    <pubDate>Mon, 24 Oct 2016 08:21:01 GMT</pubDate>
    <dc:creator>SoLuD</dc:creator>
    <dc:date>2016-10-24T08:21:01Z</dc:date>
    <item>
      <title>VBS using SAS variables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/306723#M1927</link>
      <description>&lt;P&gt;Dear all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you, please, help me with the problem?&lt;/P&gt;&lt;P&gt;I have a VBscript that is automatically run via MS scheduler. It runs a .EGP project (SAS enterprise guide 5.1), than goes to Excel, refreshes it and save it as of a specific date like this: "C:\Users\USER123\Desktop\CAP_&lt;STRONG&gt;2014_10_20&lt;/STRONG&gt;.xlsx". This date takes place in SAS as a variable&amp;nbsp;that is set as "&lt;SPAN&gt;prev_bd".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;So, what I need&lt;/U&gt;: can VBscript somehow take the value of this variable from SAS and use it further?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VBscript consists of 2 parts:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1) Standard code LAUNCHING, RUNNING and SAVING SAS.&lt;/STRONG&gt;&lt;/U&gt; I shall not display it for it is too common;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2) LAUNCHING, REFRESHING AND SAVING EXCEL:&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;Public Excelapp , ExcelFile ,Sam_Refresh ,Sam_Refresh_Sheet ,ExcelSheet, strLast_BD&lt;/P&gt;&lt;P&gt;Set Excelapp = CreateObject("Excel.Application")&lt;BR /&gt;Set ExcelFile = Excelapp.Workbooks.Open("&lt;SPAN&gt;C:\Users\&lt;/SPAN&gt;&lt;SPAN&gt;USER123&lt;/SPAN&gt;&lt;SPAN&gt;\Desktop\CAP_&lt;/SPAN&gt;Template&lt;SPAN&gt;.xlsx&lt;/SPAN&gt;")&lt;BR /&gt;Set Sam_Refresh = Excelapp.Workbooks.Open("&lt;SPAN&gt;C:\Users\&lt;/SPAN&gt;&lt;SPAN&gt;USER123&lt;/SPAN&gt;&lt;SPAN&gt;\Desktop\&lt;/SPAN&gt;SAM_refresh.xlsm") &amp;nbsp; &amp;nbsp;' I have to go to this file and extract&amp;nbsp;&lt;SPAN&gt;strLast_BD (same value as&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;prev_bd" from SAS).&lt;/SPAN&gt;&lt;BR /&gt;Set Sam_Refresh_Sheet = Sam_Refresh.Sheets(1)&lt;BR /&gt;Set ExcelSheet = ExcelFile.Sheets(1)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Excelapp.DisplayAlerts = False&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sam_Refresh.RefreshAll&lt;BR /&gt;With Sam_Refresh_Sheet&lt;BR /&gt;set strLast_BD= .Range ("C4")&lt;BR /&gt;end with&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;With ExcelFile&lt;BR /&gt;.RefreshAll&lt;BR /&gt;.SaveAs _&lt;BR /&gt;"" &amp;amp; ExcelFile.Path &amp;amp; "" &amp;amp; _&lt;BR /&gt;"\" &amp;amp; Left(Left(ExcelFile.Name, (InStrRev(ExcelFile.Name, ".", -1, vbTextCompare) - 1)), (InStrRev(ExcelFile.Name, "_", -1, vbTextCompare) - 9)) &amp;amp; "" &amp;amp; _&lt;BR /&gt;"_" &amp;amp; &lt;STRONG&gt;strLast_BD&lt;/STRONG&gt; &amp;amp; ".xlsx", 51&lt;BR /&gt;end with&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;with Excelapp&lt;BR /&gt;.DisplayAlerts = False&lt;BR /&gt;.save&lt;BR /&gt;.Quit&lt;BR /&gt;end with&lt;/P&gt;&lt;P&gt;Excelapp.quit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In case you need SAS code or something else I would be glad to share it with you!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 08:21:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/306723#M1927</guid>
      <dc:creator>SoLuD</dc:creator>
      <dc:date>2016-10-24T08:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: VBS using SAS variables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/306728#M1928</link>
      <description>&lt;P&gt;For communication between separate processes, either write the data to a text file, or store it in an environment variable, if the processes share the same environment.&lt;/P&gt;
&lt;P&gt;External files are usually the more robust method, and you can easily read the value after the fact.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 08:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/306728#M1928</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-24T08:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: VBS using SAS variables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/306731#M1929</link>
      <description>&lt;P&gt;Can you not pass the variable information through as paratemeters to the VBS script, this post shows some examples:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/2806713/can-i-pass-an-argument-to-a-vbscript-vbs-file-launched-with-cscript" target="_blank"&gt;http://stackoverflow.com/questions/2806713/can-i-pass-an-argument-to-a-vbscript-vbs-file-launched-with-cscript&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 08:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/306731#M1929</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-24T08:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: VBS using SAS variables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/307053#M1935</link>
      <description>&lt;P&gt;KurtBremser,&amp;nbsp;RW9, thank you for the help!&lt;/P&gt;&lt;P&gt;I tried to pass the date to .txt file from SAS. Works good but this methond is pretty the same as mine, so I should keep it for now.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 07:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/VBS-using-SAS-variables/m-p/307053#M1935</guid>
      <dc:creator>SoLuD</dc:creator>
      <dc:date>2016-10-25T07:56:43Z</dc:date>
    </item>
  </channel>
</rss>

