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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top