Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
New Contributor

Straight Table macro will only adjust First Column's Width

I am trying to create a simple macro to adjust the column width of a straight table with much more precision than manually dragging the column’s border.

My current macro is:

SUB Straight_Column_Resize

     ST_ID = INPUTBOX("Input the Straight Table's Object ID.")

     ST_COL_NUMBER = INPUTBOX("Input the Straight Table's column number to adjust.")

     ST_COL_WIDTH = INPUTBOX("Input the column width in pixels.")

     SET ST = ActiveDocument.GetSheetObject(ST_ID)

     ST.SetPixWidths ST_COL_NUMBER, ST_COL_WIDTH

END SUB

The problem I am having is the macro will only adjust (no matter the second argument) the first column. Any thoughts? Thanks

1 Solution

Accepted Solutions
Highlighted
Honored Contributor II

Re: Straight Table macro will only adjust First Column's Width

' sets chart column widths

sub ColWidth

  set chart = ActiveDocument.GetSheetObject("CH08")  

  set cp = chart.GetProperties

  set dims = cp.Dimensions

  set exprs = cp.Expressions

'  msgbox dims.count

  for i = 0 to dims.count-1

  dims(i).ColWidth = 175

  next

  chart.SetProperties cp

  for i = 0 to exprs.count-1

set expr = cp.Expressions.Item(i).Item(0).Data.ExpressionVisual

      expr.ColWidth = 250

  next

  chart.SetProperties cp

end sub

View solution in original post

2 Replies
Highlighted
Honored Contributor II

Re: Straight Table macro will only adjust First Column's Width

' sets chart column widths

sub ColWidth

  set chart = ActiveDocument.GetSheetObject("CH08")  

  set cp = chart.GetProperties

  set dims = cp.Dimensions

  set exprs = cp.Expressions

'  msgbox dims.count

  for i = 0 to dims.count-1

  dims(i).ColWidth = 175

  next

  chart.SetProperties cp

  for i = 0 to exprs.count-1

set expr = cp.Expressions.Item(i).Item(0).Data.ExpressionVisual

      expr.ColWidth = 250

  next

  chart.SetProperties cp

end sub

View solution in original post

Highlighted
New Contributor

Re: Straight Table macro will only adjust First Column's Width

Thanks! That got it!