Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I got the code for opening all files within a particule folder yesterday from William through NG. When I wrote to William I had the requirement for opening all the Excel files within the folder "c:\ccapps\ttlview\tmp\" but while fitting it with other parts of the code I find that I need to open all the Excel files one step down from "tmp" folder also. That step down folder will be determined from today's date, formatted as "dd-mmm-yy". I modified his code to the following one :- Sub savingasnewname() With Application.FileSearch .NewSearch p = Format(Now, "dd-mmm-yy") .LookIn = ("c:\ccapps\ttlview\tmp\" & p) .SearchSubFolders = False .FileType = msoFileTypeExcelWorkbooks .Execute For i = 1 To .FoundFiles.Count 'MsgBox "Hi" Set wb = Workbooks.Open(Filename:=.FoundFiles(i)) Next i End With End sub I thought that today being 10-Jun-04 I will get all the excel files within folder "c:\ccapps\ttlview\tmp\10-Jun-04" bring opened, but the code wasnt executing anything. I introduced a message box statement to know if the code was going inside the "for loop" but it is not. I understand that the problem is in ".Lookin" statement where Im combining a constant and a variable. Is there any way I may resolve the same. ( The folder by today's date would always exist because this code is the last in a sequence of codes and the previous codes have already created folder with name being today's date.) Regards, Hari India |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding files in a folder. Variable not defined error. | Excel Discussion (Misc queries) | |||
Default folder for opening/saving files | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
Activating "Todays Date" column upon opening? | Excel Discussion (Misc queries) | |||
Opening all txt files in a folder and saving as excel | Excel Programming |