• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Code :To create copy of .xlsx files from .Csv

Monty

Well-Known Member
Hello Everyone!

Quick question...we get 100 + files in .Csv format which need to be converted to .xlsx..

Just thinking to create a macro which can go to folder and subfolder and create copy of .Csv files to .xlsx without opening the file and overwritting it.

***No attachment provided

Any clue...Thanks.
 
Hi, Monty!
Would it be possible to move them to the same folder? That will make much easier the required code.
Regards!
 
Hi all,
I have same question. My purpose is have to calculate many file inside a source folder.But now my method is open csv file -> copy data to excel file -> close csv file.
Because there are many csv file, and I have to check condition the name of csv file before open,this task lost long time.
 

Attachments

  • Calculator.xlsm
    46.4 KB · Views: 1
Hi !
Just thinking to create a macro which can go to folder and subfolder and create copy of .Csv files to .xlsx without opening the file and overwritting it.
Easy way for any beginner is to activate the Macro Recorder,
open a csv file and save it as xlsx (so no overwritting !) …

Dir inner VBA function can scan files, easier if files are located in
a single folder.
For subfolder, Dir procedure must be written in a recursive way …

Other way to directly read a text file in memory is via Open statement
(Open pathname For Input to see in VBA inner help)
but harder than using Excel inner features like Workbooks.Open / OpenText and SaveAs / SaveCopyAs methods …

Another way without opening the file (which sounds in Excel (?) 'cause
to read a file it must be opened whatever the way !) is using
ADODB activeX (for advanced users) samples in this forum
like over the Web …
 
Hi Chihiro,
Thank you so much. you give me a idea to get data in csv file without open it.
I try to use code in the thread which you show, but still can not solve.
I have many file need to get data, but file name is different.
Each file need to calculate data input to excel file.
So can you check my file and support me.
 

Attachments

  • getcsvdata.xlsm
    25.2 KB · Views: 2
  • New folder.zip
    29 KB · Views: 0
Back
Top