<?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: setting column widths using a macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439156#M694880</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the answer.&amp;nbsp; The problem that I'm having, however, is that I can't get the obj.SetPixWidth past the "Test" button in the macro window.&amp;nbsp; I've got the following:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public sub MyHide&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call HideColumn("CH26",5)&lt;BR /&gt;end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private sub HideColumn(ch,n)&lt;BR /&gt;&amp;nbsp; set ch = ActiveDocument.GetSheetObject(ch)&lt;BR /&gt;&amp;nbsp; ch.SetPixWidth (n), 50&lt;BR /&gt;end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get "&lt;SPAN style="font-size: 8pt;"&gt;Object doesn't support this property or method: 'ch.SetPixWidth'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a stand-alone version so I don't have a server.&amp;nbsp; I don't know if that has anything to do with it or what?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mitch&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Jun 2013 18:33:45 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-06-07T18:33:45Z</dc:date>
    <item>
      <title>setting column widths using a macro</title>
      <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439154#M694878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a chart, which is really a table of data with a bunch of columns.&amp;nbsp; I'd like to set the column widths of a bunch of columns to the same width.&amp;nbsp; I looked through these discussions and it seemed that a macro was the way to go.&amp;nbsp; I tried copying some examples, adapting them (so I thought) to my situation.&amp;nbsp; One used: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set ch = ActiveDocument.GetSheetObject("CH01")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ch.SetPixWidth 0, 50&lt;/P&gt;&lt;P&gt;When I clicked TEST, it didn't like the SetPixWidth.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried another that had:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set obj = ActiveDocument.GetSheetObject("CH01")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set objProp = obj.GetProperties &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set objDim = objProp.Dimensions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objDim(i).ColWidth = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;The above shows the lines that I used and changed for my sheet object number.&amp;nbsp; It didn't like the last statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I have no idea what the object model is for QlikView and I'm really just guessing.&amp;nbsp; I don't know what the members of a sheet object are.&amp;nbsp; Can anyone either help me with the specific problem of setting a bunch of columns to a specific width, or direct me to some documentation on the object model that might help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mitch&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2013 21:50:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439154#M694878</guid>
      <dc:creator />
      <dc:date>2013-06-04T21:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: setting column widths using a macro</title>
      <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439155#M694879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mitch,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is a extended version of your trying with a loop through variables to control the width from specific columns. I think it will be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub PrepareColumn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim doc, obj, varColumnList, varColumn, varColumnVisible, varColumnWidth, i, ii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set doc = ActiveDocument&lt;/P&gt;&lt;P&gt;set obj = doc.GetSheetObject("CH10012")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;varColumnVisible = doc.Variables("vHelpColumnVisible").GetContent.String&lt;/P&gt;&lt;P&gt;if varColumnVisible = "on" then varColumnWidth = 40 else: varColumnWidth = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;varColumnList = doc.Variables("vHelpColumnList").GetContent.String&lt;/P&gt;&lt;P&gt;varColumn = split(varColumnList, ";")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i = 0 to ubound(varColumn)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if instr(varColumn(i), "-") = 0 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obj.SetPixWidth varColumn(i), varColumnWidth&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; for ii = cint(left(varColumn(i), instr(varColumn(i), "-") - 1)) to cint(mid(varColumn(i), instr(varColumn(i), "-") + 1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obj.SetPixWidth ii, varColumnWidth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 11:14:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439155#M694879</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-06-05T11:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: setting column widths using a macro</title>
      <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439156#M694880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the answer.&amp;nbsp; The problem that I'm having, however, is that I can't get the obj.SetPixWidth past the "Test" button in the macro window.&amp;nbsp; I've got the following:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public sub MyHide&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call HideColumn("CH26",5)&lt;BR /&gt;end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private sub HideColumn(ch,n)&lt;BR /&gt;&amp;nbsp; set ch = ActiveDocument.GetSheetObject(ch)&lt;BR /&gt;&amp;nbsp; ch.SetPixWidth (n), 50&lt;BR /&gt;end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get "&lt;SPAN style="font-size: 8pt;"&gt;Object doesn't support this property or method: 'ch.SetPixWidth'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a stand-alone version so I don't have a server.&amp;nbsp; I don't know if that has anything to do with it or what?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mitch&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 18:33:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439156#M694880</guid>
      <dc:creator />
      <dc:date>2013-06-07T18:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: setting column widths using a macro</title>
      <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439157#M694881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mitch,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it is the brackets around parameter "n". I don't sure whether the reuse from "ch" in this case proper worked, try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private sub HideColumn(ch,n)&lt;/P&gt;&lt;P&gt;&amp;nbsp; dim obj&lt;/P&gt;&lt;P&gt;&amp;nbsp; set obj = ActiveDocument.GetSheetObject(ch)&lt;/P&gt;&lt;P&gt;&amp;nbsp; obj.SetPixWidth (n), 50&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Jun 2013 08:59:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439157#M694881</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-06-08T08:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: setting column widths using a macro</title>
      <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439158#M694882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marcus I have tried your logic on a PIVOT table and it works great.&amp;nbsp; However, when I try and apply that same logic to a straight table it returns the error mentioned above.&amp;nbsp; Is there a way for this to work with straight tables?&amp;nbsp; Perhaps that is the issue I am having......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jun 2013 15:22:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439158#M694882</guid>
      <dc:creator>phcaptjim</dc:creator>
      <dc:date>2013-06-14T15:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: setting column widths using a macro</title>
      <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439159#M694883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take for a straight table SetPixWidths instead SetPixWidth - see also the examples in APIguide.qvw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jun 2013 15:40:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439159#M694883</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-06-14T15:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: setting column widths using a macro</title>
      <link>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439160#M694884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marcus, thanks!&amp;nbsp; Works perfectly!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jun 2013 15:51:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/setting-column-widths-using-a-macro/m-p/439160#M694884</guid>
      <dc:creator>phcaptjim</dc:creator>
      <dc:date>2013-06-14T15:51:27Z</dc:date>
    </item>
  </channel>
</rss>

