<?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 Can I set ActiveObject in Macro? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Can-I-set-ActiveObject-in-Macro/m-p/307157#M113454</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;There might be more than one active object.&lt;/P&gt;&lt;P&gt;... but you can loop all of them and apply your macro to all the active ones.&lt;/P&gt;&lt;P&gt;The following code will let you loop all the objects in the active sheet and check which ones are active&lt;/P&gt;&lt;P&gt;r&lt;/P&gt;&lt;P&gt;set s=ActiveDocument.ActiveSheet&lt;/P&gt;&lt;P&gt;objs=s.GetSheetObjects&lt;/P&gt;&lt;P&gt;for i=lbound(objs) to ubound(objs)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if objs(i).IsActive then objs(i).Minimize&lt;/P&gt;&lt;P&gt;' Instead of minimize, you could start your code&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jun 2011 20:50:48 GMT</pubDate>
    <dc:creator>erichshiino</dc:creator>
    <dc:date>2011-06-21T20:50:48Z</dc:date>
    <item>
      <title>Can I set ActiveObject in Macro?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-set-ActiveObject-in-Macro/m-p/307156#M113453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm wondering if it is possible to make the macro below a bit more dynamic.&lt;/P&gt;&lt;P&gt;It is the part that goes &lt;/P&gt;&lt;P&gt;Set chart = ActiveDocument.GetSheetObject("CH72")&lt;/P&gt;&lt;P&gt;that I want to change into selecting the object that is active instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anyone who knows if this is possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub SaveFile&lt;/P&gt;&lt;P&gt;Dim outputFile, oFSO, oFile, line&lt;/P&gt;&lt;P&gt;'Get filename for saving&lt;/P&gt;&lt;P&gt;outputFile = GetFileSaveDlg()&lt;/P&gt;&lt;P&gt;'Create necessary objects&lt;/P&gt;&lt;P&gt;Set oFSO = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;Set oFile = oFSO.CreateTextFile(outputFile)&lt;/P&gt;&lt;P&gt;Set chart = ActiveDocument.GetSheetObject("CH72")&lt;/P&gt;&lt;P&gt;'Loop through rows and columns of chart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; For row = 0 to chart.GetRowCount-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; line = ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For col = 0 to chart.GetColumnCount-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (Len(line) &amp;gt; 0) Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line = line &amp;amp; VbTab&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get cell value and append to line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set cell = chart.GetCell(row, col)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; line = line &amp;amp; cell.Text&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Write line to file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oFile.WriteLine line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; oFile.Close&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;br&lt;/P&gt;&lt;P&gt;Martin &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2011 14:34:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-set-ActiveObject-in-Macro/m-p/307156#M113453</guid>
      <dc:creator />
      <dc:date>2011-06-21T14:34:30Z</dc:date>
    </item>
    <item>
      <title>Can I set ActiveObject in Macro?</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-set-ActiveObject-in-Macro/m-p/307157#M113454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;There might be more than one active object.&lt;/P&gt;&lt;P&gt;... but you can loop all of them and apply your macro to all the active ones.&lt;/P&gt;&lt;P&gt;The following code will let you loop all the objects in the active sheet and check which ones are active&lt;/P&gt;&lt;P&gt;r&lt;/P&gt;&lt;P&gt;set s=ActiveDocument.ActiveSheet&lt;/P&gt;&lt;P&gt;objs=s.GetSheetObjects&lt;/P&gt;&lt;P&gt;for i=lbound(objs) to ubound(objs)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if objs(i).IsActive then objs(i).Minimize&lt;/P&gt;&lt;P&gt;' Instead of minimize, you could start your code&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2011 20:50:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-set-ActiveObject-in-Macro/m-p/307157#M113454</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2011-06-21T20:50:48Z</dc:date>
    </item>
  </channel>
</rss>

