Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
' 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
' 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
Thanks! That got it!