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!

open a csv file

Status
Not open for further replies.

Positivethinking

Programmer
Dec 17, 2008
9
US
Hi all

I need to open a csv file using vba and just rename the columns for a file that holds around 300 columns. I know that msaccess can handle only 255 columns. The questions is "does anyone know if handling 300 columns can be done in access without opening the csv file in a table just working as a text file"?
e.g.

Col Column Long Name Column Short Name
1 Name1 100 characters Name1 with 20 chars.
2 Name2 100 characters Name2 with 20 chars.
2 Name3 100 characters Name3 with 20 chars.
.......
300 Name300 100 charrs Name300 with 20 chars.

Thanks a lot for your help. It's very appreciated
 
I forgot to add that, the csv files comes out automatically from a medical machine with this long column names. so i need to create a vba process to read the csv files and then rename the columns to a shorter name, for several files a day and each file hold around 300 cols.


Thanks a lot
 
I doubt there is any "column" limitation on a .csv file, it's just another text file when you open it thru code. Your first line has the column names, correct? You can use the various text file manipulation code as is discussed here:


if it were me, I'd open the file, manipulate the top row as a text string, write the text string out to another text file and then add the rest of the csv file to it starting at the next line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top