473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Wildcard to locate file in Folder and in Subfolders

Hi.... I'm getting closer to understanding the wildcard function in VBA, however we have a vendor that will supply us many files, and unfortunately will place them in different folders with no uniformity.

I'd like to have the capability to find the file based on name, whether it's in a main folder, or one of the subfolders.

I.e. - File named "*Net Rebate*" will be in and of the following folders:

Main Folder
Subfolder 1
Subfolder 1a
Subfolder 1b
Subfolder 2
Subfolder 2a
Subfolder 2b

ect..... could be many subfolders.

How can I "Loop" through this to find a file "*Net Rebate*" and open it up?

So far I have:

On Error Resume Next
Dim i As Integer
With Application.FileSearch
.LookIn = ([RebDetail])
'* represents wildcard characters
.Filename = "*Net Rebate*.xls"
If .Execute > 0 Then 'Workbook exists
For i = 1 To .FoundFiles.Count
Workbooks.Open (.FoundFiles(i))
Next i
End If
End With

Any help would be appreciated!!!

Thank you.
Jul 16 '08 #1
0 1379

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: mscir | last post by:
I just installed ASP after a couple of years of not using it, PWS Win 98 SE. A couple of things are throwing me, and I can't remember whether these worked in the past. One is I can't...
2
by: Mark Rae | last post by:
Hi, Just looking for some advice and/or recommendations here. Scenario is corporate private intranet, ASP.NET 2 on Win2K3S, SQL Server 2005, WinXP + IE6 on all client desktops. Client has a...
5
by: Justin Fancy | last post by:
Hi Everyone, I am developing a file aging program that will eventually report on every folder that is in the root directory. I have a list of requested years, and counters set up to count every...
1
by: MM User | last post by:
Hi, I have a directory which I would like to search and list the latest file together with it date and time, I've found the following from w3schools for a particular file but do not know how to...
2
by: deve8ore | last post by:
Hello, I have built a macro to automatically go to a specific directory and a specific folder, however the names of the files I need to automatically locate change names every month. I.e. - I...
3
by: deve8ore | last post by:
Hello, I have built a macro to automatically go to a specific directory and a specific folder, however the names of the files I need to automatically locate change names every month. I.e. - I...
0
by: =?Utf-8?B?QnJ5YW4=?= | last post by:
Hello group. I've migrated from Win 2003 server to Win 2008 server. I've been banging my head agaist a wall for several days now trying to figure this out. I have the following script that will...
1
by: FredrikS | last post by:
Hello, This problem is driving me crazy. I've got a local website set up in IIS to develop using asp and html, etc, on a folder called Projekt. I have given IUSR_mymachine read & write permissions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.