Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
fredericvillemi
Creator III
Creator III

How to change the width of a expression in a listbox by macro ?

Hello,

I'm using a VB Macro to add an expression to all the listboxes of my document.

Set prop = Objects(k).GetProperties

Set c = prop.Expressions

    c.Add

Set x = c.Item(c.Count - 1)

x.Data.ExpressionData.Definition.v = "count(distinct [Ticket])"

Objects(k).SetProperties prop

The problem is that the column is very small and I would like to change the width.

How can I change it ?

I presume it is something with : x.FrameDef.colwidth but i can't find the exact value

And the documentation of this API is really small ..

Thanks

1 Solution

Accepted Solutions
fredericvillemi
Creator III
Creator III
Author

Hello,

this code is for the width of the listbox itself, not the expression.

I have found the answer by using Excel's VBA and the references for Qlikview objects.

In my example, I need to add this line :


Set prop = Objects(k).GetProperties

Set c = prop.Expressions

    c.Add

Set x = c.Item(c.Count - 1)

x.Data.ExpressionData.Definition.v = "count(distinct [Ticket])"

x.Data.ExpressionVisual.colWidth=50

Objects(k).SetProperties prop

Thanks anyway

View solution in original post

2 Replies
m_woolf
Master II
Master II

This code should work:

set obj = ActiveDocument.GetSheetObject( "LB01" )

set fr = obj.GetFrameDef

pos = fr.Rect

pos.Width = 300

obj.SetFrameDef fr

fredericvillemi
Creator III
Creator III
Author

Hello,

this code is for the width of the listbox itself, not the expression.

I have found the answer by using Excel's VBA and the references for Qlikview objects.

In my example, I need to add this line :


Set prop = Objects(k).GetProperties

Set c = prop.Expressions

    c.Add

Set x = c.Item(c.Count - 1)

x.Data.ExpressionData.Definition.v = "count(distinct [Ticket])"

x.Data.ExpressionVisual.colWidth=50

Objects(k).SetProperties prop

Thanks anyway