<?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 delete empty sheets in active workbook in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-delete-empty-sheets-in-active-workbook/m-p/1763675#M454150</link>
    <description>&lt;P&gt;The VBS from Qlik is quite near to the VBA from Excel but it's not the same. In this sense I'm not sure that you could simply call the Excel instance with application and using Excel features like ActiveWorkbook or similar. This means you should specify the calls explicitly. Anywhere within the macro you have created the instance and the workbook and you should use their references, something like:&lt;/P&gt;&lt;P&gt;...&lt;BR /&gt;set appExcel = createobject(...)&lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;...&lt;BR /&gt;appExcel&lt;SPAN&gt;.DisplayAlerts = False&lt;/SPAN&gt;&lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;Such approach may not always necessary but it avoids some problems.&lt;/P&gt;&lt;P&gt;Further you name the sheets once Sheets and once MySheets which is probably not correct.&lt;/P&gt;&lt;P&gt;Beside this you may bypass the whole deleting-stuff if you would skip the export of empty tables. For this you could query how many rows/columns the Qlik object has but I think it may be easier to count the number of available dimensions-values of your objects within a variable.&lt;/P&gt;&lt;P&gt;Many good examples and some explanations to the Qlik macros could you find within the APIGuide.qvw within your Qlik install-folder by automation.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
    <pubDate>Mon, 23 Nov 2020 11:10:25 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2020-11-23T11:10:25Z</dc:date>
    <item>
      <title>Macro to delete empty sheets in active workbook</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-delete-empty-sheets-in-active-workbook/m-p/1763587#M454149</link>
      <description>&lt;P&gt;Good day all,&lt;/P&gt;&lt;P&gt;I have an old school macro to export multiple data tables to excel on multiple tabs with multiple names. Once exported I do the normal format etc. etc.&amp;nbsp; What I want to do is loop through all the sheets exported and delete all the sheets that has no data in row A2. This may change based on the selection in the qlik model. I have tried the below where I insert the scrip at the end of the current "export" and "format " sub, but when I run the macro via button - at the end it just jumps back to the macro scrip with no errors. Any help would be greatly appreciated as my macro "VBA" knowledge is not great . Thanks in advance.&lt;/P&gt;&lt;P&gt;Dim Sheets 'As Worksheet&lt;/P&gt;&lt;P&gt;Application.DisplayAlerts = False&lt;BR /&gt;For Each Sheets In ActiveWorkbook.Worksheets&lt;BR /&gt;If MySheets.Range("A2") = "" Then&lt;BR /&gt;Sheets.Delete&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;BR /&gt;Application.DisplayAlerts = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I know this is an old school solution to Nprinting and Nprinting would be the way to go, but our company will not invest in Nprinting for now. Maybe in the future but for now I need the alternative solution. Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:34:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-delete-empty-sheets-in-active-workbook/m-p/1763587#M454149</guid>
      <dc:creator>stevietm</dc:creator>
      <dc:date>2024-11-15T23:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to delete empty sheets in active workbook</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-delete-empty-sheets-in-active-workbook/m-p/1763675#M454150</link>
      <description>&lt;P&gt;The VBS from Qlik is quite near to the VBA from Excel but it's not the same. In this sense I'm not sure that you could simply call the Excel instance with application and using Excel features like ActiveWorkbook or similar. This means you should specify the calls explicitly. Anywhere within the macro you have created the instance and the workbook and you should use their references, something like:&lt;/P&gt;&lt;P&gt;...&lt;BR /&gt;set appExcel = createobject(...)&lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;...&lt;BR /&gt;appExcel&lt;SPAN&gt;.DisplayAlerts = False&lt;/SPAN&gt;&lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;Such approach may not always necessary but it avoids some problems.&lt;/P&gt;&lt;P&gt;Further you name the sheets once Sheets and once MySheets which is probably not correct.&lt;/P&gt;&lt;P&gt;Beside this you may bypass the whole deleting-stuff if you would skip the export of empty tables. For this you could query how many rows/columns the Qlik object has but I think it may be easier to count the number of available dimensions-values of your objects within a variable.&lt;/P&gt;&lt;P&gt;Many good examples and some explanations to the Qlik macros could you find within the APIGuide.qvw within your Qlik install-folder by automation.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 11:10:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-delete-empty-sheets-in-active-workbook/m-p/1763675#M454150</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-11-23T11:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to delete empty sheets in active workbook</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-delete-empty-sheets-in-active-workbook/m-p/1763681#M454151</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply, The "Sheet and MySheet" is just a typo, sorry about that.&lt;/P&gt;&lt;P&gt;The reason why it exports empty table is because I have&amp;nbsp; 10+ companies. One user can log in with one company and they might not have data for that table but the macro just exports the object. Will go check out&amp;nbsp;&lt;SPAN&gt;APIGuide.qvw thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 11:28:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-delete-empty-sheets-in-active-workbook/m-p/1763681#M454151</guid>
      <dc:creator>stevietm</dc:creator>
      <dc:date>2020-11-23T11:28:59Z</dc:date>
    </item>
  </channel>
</rss>

