Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro for column width

Hi Team,

I have just copied this macro from some old post, thus thought of creating new thread,

actually I want to use this macro in my app, but not able to figure out the changes I have to make.

Can somebody please guide me here ??

sub PrepareColumn

dim doc, obj, varColumnList, varColumn, varColumnVisible, varColumnWidth, i, ii

set doc = ActiveDocument

set obj = doc.GetSheetObject("CH10012")

varColumnVisible = doc.Variables("vHelpColumnVisible").GetContent.String

if varColumnVisible = "on" then varColumnWidth = 40 else: varColumnWidth = 0

varColumnList = doc.Variables("vHelpColumnList").GetContent.String

varColumn = split(varColumnList, ";")

for i = 0 to ubound(varColumn)

    if instr(varColumn(i), "-") = 0 then

        obj.SetPixWidth varColumn(i), varColumnWidth

    else

        for ii = cint(left(varColumn(i), instr(varColumn(i), "-") - 1)) to cint(mid(varColumn(i), instr(varColumn(i), "-") + 1))

            obj.SetPixWidth ii, varColumnWidth

        next

    end if

next

end sub

http://community.qlik.com/message/353335#353335

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Change then value CH10012 into the object id of the chart that you want the macro to modify

You may want to change the value of the variable varColumnWidth to something else than 40 too.


talk is cheap, supply exceeds demand