Hi #DIV/0!
I think probably simplifying any code got from a macro recording usually means to a large extent, as Trevor suggested, taking things out and seeing what happens.
_...........................................................
I was actually, by coincidence, just now, trying out a lot of different ways of importing Pipe delimited files into Excel for myself.
Your way is probably the only way I have not tried yet. If you ever get it simplified and understand the code , then I would be interested to add it to my collection.
_...........................
Here below is a code showing just one of the ways I am currently trying. I have adapted it to your code. The main “adaptation” was the Application.GetOpenFilename( __, which I don’t do usually .
I just tested this on a text file of mine of about 255 columns by 8790 rows, Pipe delimited. ( You never have to know how many columns or rows you have ).
It seems to work. My text data is simple text, ( including commas in it ) and numbers from about 0.0000001 to 1000. I do not have any very large numbers so I do not know what sort of changing Excel might decide to do from “normal” to scientific notation. I don’t understand all that and usually get really pissed off when Excel changes things like that.
If you want to try out the code below and have any problems getting it to work, then give me a text file and I will try it out for you.
If you want to know then how it works I will be happy to bore you to death with the explanation. I would not personally recommend using the code if you have no idea how it works. ( My last explanation of this sort of code I did today here https://www.excelforum.com/excel-pro...ml#post4655965 a few minutes ago ). If you want me to explain the code, then please read that first, then I will try to explain again and apply the explanation specifically to your code version.
Alan
Edit: Thursday 18th May 2017 : Commented out the ' Let oRsT.CursorLocation = adUseClient
- see Post 11
Bookmarks