CSV files are raw text data without any display information. The short answer is "you can't."
The longer answer is you can't do it with CSV files. However, you can save the file as a different format that includes display information along with the data (eg, XLS, or even HTML tables imported into Excel). This might not even be an issue if the CSV requirement is for processing data through another program.
If you are using scripting of any sort to open the CSV in Excel, one possibility is to simply autosize all columns to fit after opening the file:
Worksheets("Sheet1").Columns("A:I").AutoFit
Of course, change I
to the appropriate column needed.
Reference: AutoFit Method [Excel 2003 VBA Language Reference]
精彩评论