LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Opening CSV in excel from VB

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" wrote in
message ...

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


--
lonfnico
------------------------------------------------------------------------
lonfnico's Profile:
http://www.excelforum.com/member.php...o&userid=33396
View this thread: http://www.excelforum.com/showthread...hreadid=532572





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I stop blank workbook from opening when opening an existing kjg Excel Discussion (Misc queries) 3 February 12th 10 09:36 PM
Opening files in Excel 2003 saved in Excel 2000 without data loss... [email protected] Excel Discussion (Misc queries) 0 January 29th 07 07:19 PM
Trouble opening large size Excel file 155Mb in Excel 2007 pl2c Excel Discussion (Misc queries) 2 July 14th 06 11:45 PM
REF errors when opening excel in xp. works fine when opening wor. br Excel Discussion (Misc queries) 6 September 13th 05 11:41 AM
excel VBA problem - setting workbook as variable & opening/re-opening safe Excel Programming 1 August 20th 04 12:22 AM


All times are GMT +1. The time now is 12:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"