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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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