Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
find a text in a file name
I need to loop throught n- number of files in a directory and if there is a
string "YTD" in the file name I had to put in cell B3 the string "YTD" and close it. Any help with the code will be appreciated Thanks Vlad |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
find a text in a file name
sName = Dir("C:\Someplace\*.xls")
Do while sName < "" if instr(sName, "YTD") then workbooks.Open "C:\Someplace\" & sName worksheets(1).Range("B3").Value = "YTD" activeWorkbook.Close SaveChanges:=True end if sName = Dir() Loop -- Regards, Tom Ogilvy "vlad" wrote in message ... I need to loop throught n- number of files in a directory and if there is a string "YTD" in the file name I had to put in cell B3 the string "YTD" and close it. Any help with the code will be appreciated Thanks Vlad |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
find a text in a file name
Tom,
Thanks for the help. As usual clean and right to the point. Thanks again "Tom Ogilvy" wrote: sName = Dir("C:\Someplace\*.xls") Do while sName < "" if instr(sName, "YTD") then workbooks.Open "C:\Someplace\" & sName worksheets(1).Range("B3").Value = "YTD" activeWorkbook.Close SaveChanges:=True end if sName = Dir() Loop -- Regards, Tom Ogilvy "vlad" wrote in message ... I need to loop throught n- number of files in a directory and if there is a string "YTD" in the file name I had to put in cell B3 the string "YTD" and close it. Any help with the code will be appreciated Thanks Vlad |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I find a file/spreadsheet that Excel says is Already open but I can't find it? | Excel Discussion (Misc queries) | |||
find from Excel VBA a text file last row | Excel Programming | |||
Excel VBA - open text file, replace text, save file? | Excel Programming | |||
Doing a find and replace in a text file | Excel Programming | |||
importing text file, removing data and outputting new text file | Excel Programming |