<?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 Macro for fast change in charts in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547593#M204521</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having difficulty getting VB script to work to fast-change a particular chart (exactly how you would by pressing the fast-change button). I got the idea from a previous post on the subject here, but I need to flip between at least 3 chart types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my macro code. I have attached it to a button. The first part works, so if the chart is currently a line chart, it changes to a bar chart. It doesn't do anything further. I have also tried nesting IF...ELSE IF statements but it doesn't work either. Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub Set1stChartType&lt;/P&gt;&lt;P&gt;&amp;nbsp; set chart = ActiveDocument.GetSheetObject("CH35")&lt;/P&gt;&lt;P&gt;&amp;nbsp; intObjectType = chart.GetObjectType&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intObjectType = 15 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a line chart&lt;/P&gt;&lt;P&gt;&amp;nbsp; chart.SetChartType&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intObjectType = 0 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a line chart&lt;/P&gt;&lt;P&gt;&amp;nbsp; chart.SetChartType&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intObjectType = 1 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a pie chart&lt;/P&gt;&lt;P&gt;&amp;nbsp; chart.SetChartType&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Nov 2013 08:17:06 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-11-20T08:17:06Z</dc:date>
    <item>
      <title>Macro for fast change in charts</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547593#M204521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having difficulty getting VB script to work to fast-change a particular chart (exactly how you would by pressing the fast-change button). I got the idea from a previous post on the subject here, but I need to flip between at least 3 chart types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my macro code. I have attached it to a button. The first part works, so if the chart is currently a line chart, it changes to a bar chart. It doesn't do anything further. I have also tried nesting IF...ELSE IF statements but it doesn't work either. Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub Set1stChartType&lt;/P&gt;&lt;P&gt;&amp;nbsp; set chart = ActiveDocument.GetSheetObject("CH35")&lt;/P&gt;&lt;P&gt;&amp;nbsp; intObjectType = chart.GetObjectType&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intObjectType = 15 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a line chart&lt;/P&gt;&lt;P&gt;&amp;nbsp; chart.SetChartType&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intObjectType = 0 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a line chart&lt;/P&gt;&lt;P&gt;&amp;nbsp; chart.SetChartType&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if intObjectType = 1 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a pie chart&lt;/P&gt;&lt;P&gt;&amp;nbsp; chart.SetChartType&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2013 08:17:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547593#M204521</guid>
      <dc:creator />
      <dc:date>2013-11-20T08:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for fast change in charts</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547594#M204522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; I suppose you are missing the ActiveDocument.GetSheetObject("CH196").SetChartType&amp;nbsp; XXX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the following macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub SetChartType_Freq&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set chart = ActiveDocument.GetSheetObject("CH178")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; intObjectType = chart.GetObjectType &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if intObjectType = 15 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a Bar chart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chart.SetChartType&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetSheetObject("CH196").SetChartType&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chart.SetChartType&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetSheetObject("CH196").SetChartType&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'0=Bar&lt;/P&gt;&lt;P&gt;'1=Pie&lt;/P&gt;&lt;P&gt;'2=Pivot&lt;/P&gt;&lt;P&gt;'3=Scatter&lt;/P&gt;&lt;P&gt;'4=Line&lt;/P&gt;&lt;P&gt;'5=Straight Table&lt;/P&gt;&lt;P&gt;'6=Combo&lt;/P&gt;&lt;P&gt;'7=Radar&lt;/P&gt;&lt;P&gt;'8=Gauge&lt;/P&gt;&lt;P&gt;'9=Grid&lt;/P&gt;&lt;P&gt;'10=Block&lt;/P&gt;&lt;P&gt;'11=Funnel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2013 09:11:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547594#M204522</guid>
      <dc:creator>bbi_mba_76</dc:creator>
      <dc:date>2013-11-20T09:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for fast change in charts</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547595#M204523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the assistance, your code works great (I realise I left out those lines). However I try to modify it in order to evaluate 3 different charts, and it fails to do anything at all. I'm sure it's because I'm unfamiliar with VBScript syntax. Here it is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub SetChartType_Freq&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set chart = ActiveDocument.GetSheetObject("CH35")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; intObjectType = chart.GetObjectType&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if intObjectType = 15 then&amp;nbsp;&amp;nbsp;&amp;nbsp; 'is currently a Bar chart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chart.SetChartType&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetSheetObject("CH35").SetChartType&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if intObjectType = 0 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; chart.SetChartType&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetSheetObject("CH35").SetChartType&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if intObjectType = 4 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; chart.SetChartType&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.GetSheetObject("CH35").SetChartType&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2013 11:28:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547595#M204523</guid>
      <dc:creator />
      <dc:date>2013-11-20T11:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for fast change in charts</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547596#M204524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you could add a msgbox to 'debug', msgbox intObjectType, to see if the values are correct (after you have to remove the msgbox).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, after you find the correct intObjectType, you have to define the fast change you need&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;IMG __jive_id="49329" alt="" class="jiveImage" src="https://community.qlik.com/legacyfs/online/49329_pastedImage_0.png" style="width: 620px; height: 504px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 08:02:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-for-fast-change-in-charts/m-p/547596#M204524</guid>
      <dc:creator>bbi_mba_76</dc:creator>
      <dc:date>2013-11-21T08:02:20Z</dc:date>
    </item>
  </channel>
</rss>

