Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Look for a string in filenames in a folder?
Hi all,
I have a spreadsheet in which I track invoices received from contractors. I am trying to create a vba routine that will be triggered from a button to search certain folders and subfolders for filename containing 2 strings. Based on the results I will then populate and format certain cells. I have no idea where to start. Could someone point me i9n the direction of some code that i could work with? Thank you very much |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Look for a string in filenames in a folder?
The Dir function should help: Dir(FilePath) gives the files in the specified
path, and you can use wildcards, e.g: Dir(MyPath & "*abc*.xls"). The first time you use Dir, you specify the path in this manner; then to find any other qualifying files in the same path you just repeat the Dir function with a zero-length string: Dir (""). Repeat until you get a zero-length string "" as the result. See the Help file for complete details. "FrigidDigit" wrote: Hi all, I have a spreadsheet in which I track invoices received from contractors. I am trying to create a vba routine that will be triggered from a button to search certain folders and subfolders for filename containing 2 strings. Based on the results I will then populate and format certain cells. I have no idea where to start. Could someone point me i9n the direction of some code that i could work with? Thank you very much |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Look for a string in filenames in a folder?
Thanks for the response!!
FD "K Dales" wrote in message ... The Dir function should help: Dir(FilePath) gives the files in the specified path, and you can use wildcards, e.g: Dir(MyPath & "*abc*.xls"). The first time you use Dir, you specify the path in this manner; then to find any other qualifying files in the same path you just repeat the Dir function with a zero-length string: Dir (""). Repeat until you get a zero-length string "" as the result. See the Help file for complete details. "FrigidDigit" wrote: Hi all, I have a spreadsheet in which I track invoices received from contractors. I am trying to create a vba routine that will be triggered from a button to search certain folders and subfolders for filename containing 2 strings. Based on the results I will then populate and format certain cells. I have no idea where to start. Could someone point me i9n the direction of some code that i could work with? Thank you very much |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to extract only file name from folder path string in Excel? | Excel Worksheet Functions | |||
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
Help with a Macro to list all filenames and mod dates in a folder | Excel Programming | |||
Folder and filenames? | Excel Programming |