Solved

Excel (.XLS) to .CSV conversion

Posted on 2010-11-11
5
675 Views
Last Modified: 2012-05-10
Hello Experts,

I would like to have an excel macro which will do the conversion from XLS to UTF8 CSV file with No Byte Order Marker and no headings.

Can you please provide any sample macro or references for this?

Thanks a lot!
Shailesh
0
Comment
Question by:ShaileshShinde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 6

Assisted Solution

by:nsonbaty
nsonbaty earned 167 total points
ID: 34109611
0
 
LVL 19

Assisted Solution

by:MINDSUPERB
MINDSUPERB earned 83 total points
ID: 34110459


Sub ConvertXLStoCSV()

    Dim strXLSFile As String
    Dim strCSVFile As String
   
    'Change Input and Output folders to relevant location
    Const strInputFolder As String = "C:\Temp\XLS\"
    Const strOutputFolder As String = "C:\Temp\CSV\"
   
    strXLSFile = Dir(strInputFolder & "*.xls")
   
    Do While strXLSFile <> ""
        strCSVFile = Left(strXLSFile, InStrRev(strXLSFile, ".")) & "csv"
        Workbooks.Open strInputFolder & strXLSFile
        ActiveWorkbook.SaveAs strOutputFolder & strCSVFile, xlCSV
        ActiveWorkbook.Close False
        strXLSFile = Dir
    Loop

End Sub


Replace the "C:\Temp\XLS\" and "C:\Temp\CSV\" with relevant folders.  Make sure you have a backslash at the end.

The macro will open every XLS file in the "Input Folder" and export them as CSV files to the "Export Folder".  It assumes that each workbook will contain only one sheet.  If you need to export multiple sheets to multiple files, it can be adapted to do so.

It doesn't test to see if the CSV file already exists and will probably prompt you to overwrite if it does.  Easier to delete the old CSV files from the Output folder first.

Source: http://forums.whirlpool.net.au/archive/565961

Sincerely,
Ed
0
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 34116355
Hello Experts,

I ran the given macro on .XLS file which contains Chinese contents and found that this does not support for Asian characters and shows up ???.

Thanks,
Shailesh
0
 
LVL 6

Accepted Solution

by:
nsonbaty earned 167 total points
ID: 34129940
make sure that the OS and the office supporting asian characters, iinstall proofing tools, and chinees lang.. first
0
 
LVL 1

Author Closing Comment

by:ShaileshShinde
ID: 34147865
Thanks A Lot!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question