Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel VBA macro that can import any text file to Excel

Hi

Is it possible to build a macro that can import any text file to Excel

I have attached an example text file

Thanks
Order-Details.txt
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

In answer to your question, is it possible, Yes it is.

I think you need to give some more detail about what you want the macro to do with the text file.

Likeiwse, why have a macro when there is already the standard text import wizard that will convert text files into columns dependent on separators or column widths unless you then want to perform some tasks on the data once imported.

Example file looks like a fairly standard Comma Separated Values file so the Import wizard will handle it fairly easily using comma as the separator.

Thanks
Rob H
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here you are !!!
Rgonzo1971 did it for you in no sweat ! :)

Just a small note this would apply for the specific file type you posted not just any text file as if it is not comma separated then code would need to be modified.
gowflow
Avatar of Murray Brown

ASKER

Thank you both for the answer and the qualification
Thanks