View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Importing csv by code

First, I'd rename the .csv file to .txt. .CSV file means something special to
excel and you'll have trouble in your code if you leave the file named .csv.

Then instead of writing the code yourself, try recording a macro when you open
the .txt file manually. You'll be able to specify the separator you want.

SteM wrote:

Hi there,
i wrote some vba code to open a csv file within Excel 2000.
Since the separator is ';' and not ',' i wrote:

Set wb = Workbooks.Open(FILENAME:=filename, ReadOnly:=True, Format:=4)

But the file is not imported correctly.
BTW: if i double-click on the file, Excel are not able to import it but if I
open the file within Excel, the file are ok.

Any idea?
--
SteM


--

Dave Peterson