<?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: IsActive test for Sheets using names not their index number in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-IsActive-test-for-Sheets-using-names-not-their-index/m-p/391255#M145924</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works fine for me in QV10: if activedocument.sheets("Main").isactive then msgbox "Yah!"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you want to know the name of the active sheet you can get it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set sp = activedocument.activesheet.getproperties&lt;/P&gt;&lt;P&gt;msgbox sp.Name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you can work around it that way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Nov 2012 09:04:00 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2012-11-01T09:04:00Z</dc:date>
    <item>
      <title>Macro: IsActive test for Sheets using names not their index number</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-IsActive-test-for-Sheets-using-names-not-their-index/m-p/391254#M145923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an application with a number of sheets/functionality, e,g P&amp;amp;L, Balance Sheet, Cashflow, Open Invoices etc.&lt;/P&gt;&lt;P&gt;Each sheet has various views, e.g. Reports, Charts, Details, displayed when the user pressses buttons that set a variable which the various filters, charts and tables test for in the Show conditional on their Layout tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some macro code that is triggered by each of these button pushes, and when moving to a different sheet. It tests which area of functionality it being viewed and then decides how to treat the date fields shown on each sheet. The default treatment is as a tool for setting an analysis date for point-in-time measures, but then under certain conditions, such as when showing a 'Details' view, they are set to be proper date filters that reduce the data when selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue I have is that, as the same application is deployed with different sheets being visible/available, how I should test which sheet is active. I am currently conducting this test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ActiveDocument.Sheets(0).IsActive then .... end if&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;However, I want to change the SheetID on the sheet properties General tab to be a more useful identifier (PL, BS, CF etc.), and then test using this sort of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ActiveDocument.Sheets("BS").IsActive then .... end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I do this it does not seem to work, bringing up the Macro editor but without saying why. Can someone advise on a better syntax ?&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;P&gt;P.S: Providing a sample application would be hard, which is why I have provided so much backgound detail&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 08:38:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-IsActive-test-for-Sheets-using-names-not-their-index/m-p/391254#M145923</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-01T08:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro: IsActive test for Sheets using names not their index number</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-IsActive-test-for-Sheets-using-names-not-their-index/m-p/391255#M145924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works fine for me in QV10: if activedocument.sheets("Main").isactive then msgbox "Yah!"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you want to know the name of the active sheet you can get it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set sp = activedocument.activesheet.getproperties&lt;/P&gt;&lt;P&gt;msgbox sp.Name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you can work around it that way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 09:04:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-IsActive-test-for-Sheets-using-names-not-their-index/m-p/391255#M145924</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-11-01T09:04:00Z</dc:date>
    </item>
  </channel>
</rss>

