VBA: how to open the only .csv file existing in a directory

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
438
Hello everybody.

I've the following directory in my pc:

Code:
R:\Users\john.smith\Downloads
It contains two files, only one of them is a .csv. But, about it, I don't know the exact name.

How can I open it exploiting the only information I have? (it is a .csv file).

Thank's.
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
438
Hello everybody.

I've the following directory in my pc:

Code:
R:\Users\john.smith\Downloads
It contains two files, only one of them is a .csv. But, about it, I don't know the exact name.

How can I open it exploiting the only information I have? (it is a .csv file).

Thank's.
I've tried this way:

Code:
Workbooks.Open ("R:\Users\john.smith\Downloads\*.csv")
but it is opened without text to columns. On the contrary, if I open it manually the text is to columns like a normal .xls file...
 

Watch MrExcel Video

Forum statistics

Threads
1,099,788
Messages
5,470,785
Members
406,720
Latest member
tylergaps

This Week's Hot Topics

Top