check to ensure all files in folder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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" <[email protected]>
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?
 
This is only returning the following:

U:\Payroll\June 15 Payroll - Adv
DisplayAdvertising10-27-06.xls
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top