View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default 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?