Open CSV as a text file ?

tsil

New Member
Joined
Mar 20, 2002
Messages
39
Hello

I have a csv file that I like to open up as a .txt file,

the reason is that the content is separated with ";" not with "," so when
the text contains "," the .csv file will separate that into another cell eventhough
it should just treat it as content between ";"

If I change the .csv with .txt then it works fine but I cannot do that with
a makro in excel without open up the .csv file...

Also if I open up the csv manually and deliminiate it, it will work, I have recorded that
as a makro but it does not work when running it as a makro.

Anyone have had the same problem and solved it...?

BR
/Tommy
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You should be able to open the CSV as a text file, thus putting all the data into column A. Then run a TEXT TO COLUMNS on that column A using the "other delimiter" of ";" and it will split your data for you, faster than converting to commas then splitting.
 
Upvote 0
You can change the name of the file using code.
Code:
Name "Filename.csv" As "filename.txt"
That's a simple example, you'd need to add paths etc.

You could also turn on the macro recorder when you open the file manuallly and delimit it to get code.
 
Upvote 0
YES!!

This was excactly what I looked for, the "Name ... as ..."
It works perfectly , thanks Norie !

BR
/Tommy



ps, I did record a makro doing what I wanted but when I ran it, it did not work.


pps. to jbeaucaire, I tried to open it up as textfile but it still used the commas as separators. The "Name .... as ..." works great though.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,258
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top