<?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 Re: Macro to export tables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548606#M440076</link>
    <description>&lt;P&gt;Can anyone help me on this?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Feb 2019 10:17:56 GMT</pubDate>
    <dc:creator>Prav</dc:creator>
    <dc:date>2019-02-25T10:17:56Z</dc:date>
    <item>
      <title>Macro to export tables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548020#M440018</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to export tables in multiple sheets in excel. I tried the macro code from the below link which is absolutely what I needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-Creating-Analytics/Macro-to-export-multiple-tables-in-to-single-excel/td-p/1037613" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/QlikView-Creating-Analytics/Macro-to-export-multiple-tables-in-to-single-excel/td-p/1037613&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The code is exporting multiple tables in a single sheet (i.e sheet 1) which is fine. But in a similar way, I have to export 2 more tables in another sheet (i.e sheet 2), and 2 more tables in another sheet&amp;nbsp;(i.e sheet 3).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can someone please guide where I should I add the tables and work sheet numbers/names from the below code. I want to add them in the same code.&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;sub exportToExcel&lt;/P&gt;&lt;P&gt;' File Path &amp;amp; Name&lt;/P&gt;&lt;P&gt;Path = "C:\temp\"&lt;/P&gt;&lt;P&gt;FileName = "Test_"&lt;/P&gt;&lt;P&gt;strSaveFile = Path &amp;amp; FileName&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'==============================================================&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'Open Excel&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;set oXL=CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oXL.visible=True&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oXL.Workbooks.Add&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aSheetObj=Array("TB01","TB02") ' Chart ID's here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'==============================================================&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for i=0 to UBound(aSheetObj)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Set oSH = oXL.ActiveSheet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;num_rows = oSH.UsedRange.Rows.Count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If num_rows = 1 then&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A2").Select&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Else&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+4).Select&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set obj = ActiveDocument.GetSheetObject(aSheetObj(i))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;obj.CopyTableToClipboard True&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Paste&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;sCaption=obj.GetCaption.Name.v&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;set obj=Nothing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Cells.Select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;oSH.Columns("A").ColumnWidth = 12.17&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Columns("B").ColumnWidth = 12.17&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If num_rows = 1 then&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Value = sCaption&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Font.Bold = True&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'oSH.Range("A" &amp;amp; num_rows).Font.ColorIndex = 3&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Interior.ColorIndex = 40&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;oSH.Range("A" &amp;amp; num_rows+3).Value = sCaption&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+3).Font.Bold = True&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'oSH.Range("A" &amp;amp; num_rows+3).Font.ColorIndex = 3&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp;num_rows+3).Interior.ColorIndex = 40&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'oXL.Selection.Columns.AutoFit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'==============================================================&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Range("A1").Select&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oXL.Sheets("Sheet2").Delete&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oXL.Sheets("Sheet3").Delete&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSH.Name = "Data"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oXL.ActiveWorkBook.SaveAs strSaveFile &amp;amp; replace(date, "/", "-") &amp;amp; ".xlsx"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;set oSH = Nothing&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;set oXL=Nothing&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end sub&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 11:35:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548020#M440018</guid>
      <dc:creator>Prav</dc:creator>
      <dc:date>2019-02-22T11:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to export tables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548133#M440026</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You have to put your OBJECT ID in the Macro script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example replace &lt;STRONG&gt;TB01&lt;/STRONG&gt; with &lt;STRONG&gt;CH26.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_1.png" style="width: 565px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/6606i1231045015E1EE9B/image-dimensions/565x250?v=v2" width="565" height="250" role="button" title="Screenshot_1.png" alt="Screenshot_1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp; &amp;nbsp; aSheetObj=Array("&lt;STRONG&gt;TB01&lt;/STRONG&gt;","TB02")&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:05:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548133#M440026</guid>
      <dc:creator>Claudiu_Anghelescu</dc:creator>
      <dc:date>2019-02-22T14:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to export tables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548135#M440027</link>
      <description>&lt;P&gt;Hi, thanks for your reply. But that is not I want. i want the same macro without replacing object IDs. So a single macro should export 2 tables in one sheet, another 2 two tables in another sheet etc.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:12:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548135#M440027</guid>
      <dc:creator>Prav</dc:creator>
      <dc:date>2019-02-22T14:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to export tables</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548606#M440076</link>
      <description>&lt;P&gt;Can anyone help me on this?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 10:17:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-export-tables/m-p/1548606#M440076</guid>
      <dc:creator>Prav</dc:creator>
      <dc:date>2019-02-25T10:17:56Z</dc:date>
    </item>
  </channel>
</rss>

