Get file name from selected file in File Explorer

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
I've set up a workflow where the users needs to log selected information from a system generated file name. Currently they single click twice on the file name (within File Explorer) and copy that file name into the clipboard.

Then I have a VBA routine that when run, takes the information from the clipboard, and pulls out just the needed information (last Name, First name, Date) and enters that information into the last line of a table. Works great and not too bad of a work flow, considering what they were doing before. (hand jamming each letter).

I'm wondering if I can have the code just looked at the selected file and do the same thing (end up with the last name, first name and Date in the column)?

So is there a way to... user selects the file in file explorer, hit a button in excel and (same as above), pulls the file name, parses it out into needed information, and put in the table.

Thanks,
Mark
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Excel can call it's own filedialog and then get the selecteditems names.
Trying to figure out which of the system file explorer's windows contains the file you need will be close to impossible in the general case.
 
Upvote 0
Ummm, thanks for the idea. Hadn’t thought about selecting during the routine, just before.
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,891
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top