Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to extract only file name from folder path string in Excel? JayKay Excel Worksheet Functions 1 March 20th 09 04:57 PM
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
Help with a Macro to list all filenames and mod dates in a folder techmoney Excel Programming 3 November 19th 04 09:52 PM
Folder and filenames? Mark[_45_] Excel Programming 6 July 1st 04 03:49 AM


All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"