View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nikos Yannacopoulos[_5_] Nikos Yannacopoulos[_5_] is offline
external usenet poster
 
Posts: 80
Default check folder event

Mark,

Try this piece of code:

Dim f, fs, fcount
fldr = "C:\Mytest"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.Getfolder(fldr)
fcount = f.Files.Count
If fcount 2 Then
MsgBox "There are more than 2 files in the folder"
End If

HTH,
Nikos

"Mark" wrote in message
...
I wonder if it possible write in VBA code(event) check
content some folder (all the time):
If amount files (different type files in c:\Mytest) is
greatest from 2 then msgbox "There is above 2 files in
folder".
I assume code should be in personal.xls and application
(Excel) opened continuously.

Can someone please suggest the best way to do this?

Regards
Mark