<?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 SAS addin 7.1 Excel VBA Slow Refresh on multiple SAS tables in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/577553#M2385</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently writing a Macro in VBA to refresh all SAS tables in an activeworkbook. I've tried two different methods, seen below, and while they work to refresh the tables, the run time is very slow in workbooks with multiple SAS tables (10 mins in some workbooks that would take 1 min if done manually). I believe this is occurring between table refreshes as it takes about 10-20 seconds to address the new table and update it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&lt;/P&gt;&lt;P&gt;Sub test()&lt;/P&gt;&lt;P&gt;Dim sas As SASExcelAddIn&lt;/P&gt;&lt;P&gt;Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Each sheet In ActiveWorkbook.Sheets&lt;BR /&gt;If sheet.Name Like "*SAS*Table*" Then&lt;BR /&gt;sheet.Activate&lt;BR /&gt;sas.Refresh ActiveWorkbook.ActiveSheet&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Next sheet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;P&gt;Sub test()&lt;/P&gt;&lt;P&gt;Dim sas As SASExcelAddIn&lt;/P&gt;&lt;P&gt;Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;sas.Refresh&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know if there is a way to speed up the time between refreshes, when a workbook has multiple tables embedded? It's to have it automated, but right now isn't worth it with how long some of the automatic refreshes are taking compared to a manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2019 21:48:46 GMT</pubDate>
    <dc:creator>sundx045</dc:creator>
    <dc:date>2019-07-29T21:48:46Z</dc:date>
    <item>
      <title>SAS addin 7.1 Excel VBA Slow Refresh on multiple SAS tables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/577553#M2385</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently writing a Macro in VBA to refresh all SAS tables in an activeworkbook. I've tried two different methods, seen below, and while they work to refresh the tables, the run time is very slow in workbooks with multiple SAS tables (10 mins in some workbooks that would take 1 min if done manually). I believe this is occurring between table refreshes as it takes about 10-20 seconds to address the new table and update it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&lt;/P&gt;&lt;P&gt;Sub test()&lt;/P&gt;&lt;P&gt;Dim sas As SASExcelAddIn&lt;/P&gt;&lt;P&gt;Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Each sheet In ActiveWorkbook.Sheets&lt;BR /&gt;If sheet.Name Like "*SAS*Table*" Then&lt;BR /&gt;sheet.Activate&lt;BR /&gt;sas.Refresh ActiveWorkbook.ActiveSheet&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Next sheet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;P&gt;Sub test()&lt;/P&gt;&lt;P&gt;Dim sas As SASExcelAddIn&lt;/P&gt;&lt;P&gt;Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;sas.Refresh&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know if there is a way to speed up the time between refreshes, when a workbook has multiple tables embedded? It's to have it automated, but right now isn't worth it with how long some of the automatic refreshes are taking compared to a manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 21:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/577553#M2385</guid>
      <dc:creator>sundx045</dc:creator>
      <dc:date>2019-07-29T21:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS addin 7.1 Excel VBA Slow Refresh on multiple SAS tables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/579200#M2387</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/283313"&gt;@sundx045&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your goal to have the SAS content refresh on workbook open? If so, enable the "Refresh on file open" option on the Execution tab of the properties of the SAS content. See screen shot below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If refresh on file open is not your goal, try using only the sample VBA code in the SAS Add-In help without other VBA present:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub RefreshContents()

    Dim sas As SASExcelAddIn
    Set sas = Application.COMAddIns.Item("SAS.ExcelAddIn").Object
    
    sas.Refresh ThisWorkbook
 
End Sub
&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-08-05_13-54-49.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31538i9AAE4062FDF17FD9/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-08-05_13-54-49.jpg" alt="2019-08-05_13-54-49.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 17:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/579200#M2387</guid>
      <dc:creator>fifthand57th</dc:creator>
      <dc:date>2019-08-05T17:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS addin 7.1 Excel VBA Slow Refresh on multiple SAS tables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/579750#M2389</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60208"&gt;@fifthand57th&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for getting back.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to create a tool to loop through multiple files and refresh the tables, as I have to refresh around 150 files. I can get it to loop through and refresh tables, but a refresh on a table that would take a couple seconds manually takes a few minutes when I try to automate it. This makes the automated refresh unjustified as it ends up taking longer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm curious if there is a way to speed up that refresh or if that's just the nature of the automation. Appreciate the help!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 20:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/579750#M2389</guid>
      <dc:creator>sundx045</dc:creator>
      <dc:date>2019-08-07T20:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS addin 7.1 Excel VBA Slow Refresh on multiple SAS tables</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/580640#M2390</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/283313"&gt;@sundx045&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each time you open an Excel workbook, the SAS Add-in for MS Office must load in Excel. Before you Refresh SAS Content, the SAS Add-in for MS Office must establish a connection to the metadata server then instantiate a workspace server where execution will occur. If I understand what you are doing correctly, you are looping through closed Excel files and refreshing SAS Content.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you refresh SAS content from VBA in this manner, the VBA must first open the Excel file, then the SAS Add-in must load in Excel, then the metadata connection occurs and workspace server is instantiated, and, finally, the refresh occurs. You likely count all of this as your "refresh time".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without using VBA, you first open the Excel file and the SAS Add-in loads, then it is likely that the metadata and workspace server connections are made before the user clicks the "Refresh" button. You are likely not counting the time it takes to open Excel, load the Add-in, make the connections, then refresh the data as your "refresh time".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 19:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/SAS-addin-7-1-Excel-VBA-Slow-Refresh-on-multiple-SAS-tables/m-p/580640#M2390</guid>
      <dc:creator>fifthand57th</dc:creator>
      <dc:date>2019-08-12T19:39:17Z</dc:date>
    </item>
  </channel>
</rss>

