Re: Opening CSV in excel from VB

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



It is not a CSV file. That is your first mistake. A CSV file is comma
separated and you have a semicolon separated. (Hint Tab Separated is
better, imo.) The comma separated files will load seven fields instead of
six fields because a field contains a comma. To fix this surround each text
field with quotes. That doesn't fix everything but it will help.
Full Name,Doe, John,First Name, John, Last name, Doe

To figure out the proper syntax for loading your specific file follow these
instructions.
Record Macro
Open the file to be imported. (File | Open)
Change the file type to "Text Files (*.prn; *.txt; *.csv)"
Select the file to be loaded.
Click Open
Enable Delimited
Click Next
Select Semicolon as the delimiter and set up any other options as required
Continue through the dialog
Once the file is imported Stop the Macro
Now look at the code that was generated and modify it as necessary.


--
My handle should tell you enough about me. I am not an MVP, expert, guru,
etc. but I do like to help.


"lonfnico" <lonfnico.267fvz_1144935005.8818@xxxxxxxxxxxxxxxxxxxxx> wrote in
message news:lonfnico.267fvz_1144935005.8818@xxxxxxxxxxxxxxxxxxxxxxxx

Format:=4 didnt work, and
Format:=6, Delimiter:=";" doesnt work either.

I have no idea how this damn csv is made, and close to no way to find
out, as its made by some external source.

If I open it with notepad, it doesnt even show the "return" chars, its
just some ascii code (as it seems) that is not taken in charge by
notedpad...

But the ; are still there!

I thought this would take 5 minutes, but finally, im going to use the
day on it :eek:


--
lonfnico
------------------------------------------------------------------------
lonfnico's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=33396
View this thread: http://www.excelforum.com/showthread.php?threadid=532572



.



Relevant Pages

  • Re: CSV dropping last comma for all lines after line 15
    ... Column Delimiters Missing in Spreadsheet Saved as Text ... Then try saving the file as a CSV file. ... noticed that Excel is dropping the last comma on the lines beyond data line ...
    (microsoft.public.excel.setup)
  • Re: CSV Export: Force Trailing Comma?
    ... write field by field to Excel when the transferSpreadsheet ... results of a MS Access query to a csv file. ... In other systems such as TOAD for Oracle, ... force an additional comma delimiter after the last column, ...
    (comp.databases.ms-access)
  • Re: how do I get the comma delimited feature to work in excel
    ... Do you save the .csv file to the harddrive first, then double click on it to ... correctl. ... "Dave Peterson" wrote: ... I just checked it and it is a comma ...
    (microsoft.public.excel.misc)
  • Re: TransferText acImportDelim Problem
    ... no problems (except the problems that Excel causes for itself!) but there is ... The problem arises when the csv file has a comma in the middle of it. ... I can easily live with Jons Company Inc.instead of Jons Company, ...
    (microsoft.public.access.externaldata)
  • Re: Importing e-mail addresses from .txt or .csv file
    ... Robert J. Salvi, Ambiance Acoustics ... > For a text format, I had to add an extra comma to the field list, and to ... > blank field to end of the form, before saving the form as a *.CSV file. ... > Robert J. Salvi, Ambiance Acoustics ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)