Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Clifton Flores   on Nov 24 In MS Office Category.

  
Question Answered By: Jaspreet Kapoor   on Nov 24

There are several ways of getting the job done,
but in order to decide which approach,
we'll need to discuss a bit more about your situation.
You mentioned that the "ABCDE" portion of the filename
varies for each report.
is it "predictable"? will there be more than one file
in a specific folder with different "ABCDE" values?
I use a technique like:
FName2008 = ""
Folder = "Z:\Reports\"
Set f = fso.GetFolder(Folder)
Set Files = f.Files
For Each File In Files
If ((Left(File.Name, 13) Like "2008") _
And (ucase(Right(File.Name, 18)) = "MKT SEG MASTER.XLS")) Then
FName2008 = File.Name
exit for
End If
Next File
In the past, I've used the "like" operator instead of the string
functions Left,Right,Instr:
if (Ucase(File.Name) Like "2008*MKT SEG MASTER.XLS") then
But I've gotten away from that
(it failed me once, so I tossed it aside!)
hope this helps,

Share: 

 
 
Didn't find what you were looking for? Find more on Might be a total newbie issue Or get search suggestion and latest updates.


Tagged: