• 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 read different format of files?

Jagdev Singh

Active Member
Hi Experts,

I am not sure if this is possible or not?. Is it possible to read/open different format of files (TXT,CSV,XLS) from a directory/drive.

Regards,
JD
 
I am not sure about your point of view.

If you want to read (using VBA) contents from mentioned types then it is possible. Each requires a separate approach due to data structure.

However, if you are asking if there's single method that can read the contents irrespective of file type then it is not possible. It will have to be a customized solution to suit the needs.

Does this answer your query?
 
Is it possible to read/open different format of files (TXT,CSV,XLS) from a directory/drive.
Hi !

Yes as you can already do that manually in Excel !

Do it, test, activate Macro Recorder, see generated code.
A lot of samples within threads of this forum …
 
My preferred method of reading different types of files it to use PowerQuery.

Has built in functionality to read, text, Excel, csv, or even a folder directly.

Data transformation is easy and requires little coding as it has good GUI.
 
Thanks everyone!

I am dealing with a situation where .csv and .xls files are saved in a common folder or location. What I am looking for is to open each file with VBA and perform set of operations and save it with .xlsx extension.

Regards,
JD
 
Back
Top