Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nick_at_cl
Contributor
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
m_woolf
Master II
Master II

' 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
m_woolf
Master II
Master II

' 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

nick_at_cl
Contributor
Contributor
Author

Thanks! That got it!