Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 231
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 231
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check Folder For Files Dave Excel Discussion (Misc queries) 6 November 21st 07 12:16 AM
Check if a folder has x files in it. Dave Excel Discussion (Misc queries) 8 November 15th 07 04:35 PM
Check if folder exists, if yes just copy sheet in to folder? Simon Lloyd[_787_] Excel Programming 3 June 19th 06 03:44 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 04:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 05:23 AM


All times are GMT +1. The time now is 03:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"