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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA and Excel

Status
Not open for further replies.

beena123

Programmer
Jul 15, 2002
1
US
I have a Visual basic application which creates a excel spreadsheet and is saved as a .txt file.

ActiveWorkbook.SaveAs Filename:="c:\temp\file.txt", FileFormat:= _
xlTextPrinter, CreateBackup:=True
Before the save I have something like this
Columns("A:O").Columns.AutoFit
if I use the autofit it truncates some of the column fields which should not happen.
Now if I take away the autofit before the save, all the columns have the required length. The problem is it wraps the last column.
for example if there are 50 rows with 10 columns, it displays 50 rows with columns 1 to 9 and then 50 rows of the 10nth column below it. so a total of 100 rows. Any one know how to get the 10nth column along with the other columns and columns not being truncated.
Thanks
 
Hi,
The correct syntax is...
Code:
   ActiveSheet.Columns("A:O").AutoFit
Hope this helps :) Skip,
SkipAndMary1017@mindspring.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top