Column Width

F

Fred***

Is there a way to set the column width in VBA? I don't want to 'auto-fit'
to contents.
Thanks.
Fred***
 
J

JackD

Fred*** said:
Is there a way to set the column width in VBA? I don't want to 'auto-fit'
to contents.
Thanks.
Fred***


Yes, you use the table edit method.
This example adds a new start column that is 19 characters wide.
You have to refresh the view for the column to become visible.
You will also want to specify all the columns (even if they aren't changed)
so that you can get them in the right order.

Sub editwidth()
TableEdit Name:="&Entry", TaskTable:=True, overwriteexisting:=True,
newfieldname:="Start", _
Title:="", Width:=19, Align:=2, LockFirstColumn:=True, DateFormat:=255,
RowHeight:=1, AlignTitle:=1
End Sub
 
F

Fred***

Thank you JackD! I'll try this out.
Fred***

JackD said:
Yes, you use the table edit method.
This example adds a new start column that is 19 characters wide.
You have to refresh the view for the column to become visible.
You will also want to specify all the columns (even if they aren't changed)
so that you can get them in the right order.

Sub editwidth()
TableEdit Name:="&Entry", TaskTable:=True, overwriteexisting:=True,
newfieldname:="Start", _
Title:="", Width:=19, Align:=2, LockFirstColumn:=True, DateFormat:=255,
RowHeight:=1, AlignTitle:=1
End Sub
 
Top