Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to define the columnwidth of EXCEL by VBA?

Status
Not open for further replies.

softlover

Programmer
Apr 4, 2002
88
CN
I want to define the columnwidth of any column in EXCEL sheet with ACCESS2K VBA.
Before do that, i had got the width value with codes:

ColumnWidth = xlBook.Sheets(1).Columns(1).Width

but the following codes can't work when redefine the newone.

xlBook.Sheets(1).Columns(2).Width = ColumnWidth
 
but the following codes can't work
Any error message ?
You may try this:
ColumnWidth = xlBook.Sheets(1).Columns(1).ColumnWidth
xlBook.Sheets(1).Columns(2).ColumnWidth = ColumnWidth

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top