Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
check to ensure all files in folder
I have a file folder where i store numerous employee timesheets - what macro
can i run to ensure that all employee timesheets are in the folder? what information is needed to answer my question? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
check to ensure all files in folder
This will list all files in the "strPath" folder... '-- Sub ListAllFilesInFolder() Dim strPath As String Dim oFSO As Object Dim oFile As Object Dim oFolder As Object Dim N As Long N = 1 strPath = "C:\Documents and Settings\Excel Files" Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder(strPath) Cells(N, 1).Value = oFolder.Path N = N + 1 For Each oFile In oFolder.Files Cells(N, 2).Value = oFile.Name N = N + 1 Next 'oFile Set oFSO = Nothing Set oFile = Nothing Set oFolder = Nothing End Sub '-- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Sarah" wrote in message I have a file folder where i store numerous employee timesheets - what macro can i run to ensure that all employee timesheets are in the folder? what information is needed to answer my question? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
check to ensure all files in folder
This is only returning the following:
U:\Payroll\June 15 Payroll - Adv DisplayAdvertising10-27-06.xls "Jim Cone" wrote: This will list all files in the "strPath" folder... '-- Sub ListAllFilesInFolder() Dim strPath As String Dim oFSO As Object Dim oFile As Object Dim oFolder As Object Dim N As Long N = 1 strPath = "C:\Documents and Settings\Excel Files" Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder(strPath) Cells(N, 1).Value = oFolder.Path N = N + 1 For Each oFile In oFolder.Files Cells(N, 2).Value = oFile.Name N = N + 1 Next 'oFile Set oFSO = Nothing Set oFile = Nothing Set oFolder = Nothing End Sub '-- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Sarah" wrote in message I have a file folder where i store numerous employee timesheets - what macro can i run to ensure that all employee timesheets are in the folder? what information is needed to answer my question? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Check Folder For Files | Excel Discussion (Misc queries) | |||
Check if a folder has x files in it. | Excel Discussion (Misc queries) | |||
Check if folder exists, if yes just copy sheet in to folder? | Excel Programming | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | 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 Programming |