View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Wildcard in workbooks open code

first = true
do
if first = true then
filename = dir("c:\temp\*709.xls")
first = false
else
filename = dir()
if filename < "" then


' enter your code - filename contains the name of the file found
' filename doesn't include path, so you may have to add path
end if
loop while filename < ""

"ksh" wrote:

Is there a way to use wild cards for the "709" part of the "200709" string
since the last two digits change every month and the 7 will change at year
end. I tried the wildcards noted in excel VBA help
("...PCC*.xls","...200???.xls","...200###") on just the file name (I haven't
even tried the folder name yet) and none of them worked.

Workbooks.Open _
("Q:\LATIN AMERICA\SABRE\2007\DATA 200709\BCDLA ACTIVE PCC 200709.XLS")