Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
check folder event
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
check folder event
Hi Nikos!
it work fine but lacking some event do continously check files in folder - at me, files in folder appear and disappear. Best Regards Mark -----Original Message----- 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 . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
check folder event
I'd like know exactly moment increase amount files (2) in
folder. Maybe vba don't have tools to do it or any tool very load memory. Regards Mark -----Original Message----- 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 . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
check folder event
Mark,
A timer function of some kind could be used to check periodically, e.g. every second or every minute or whatever suits your needs... regrettably I don't know of Excel VBA having this functionality, I think it doesn't; Access does, and VB 6.0 does. I would use VB 6.0 to do it in a stand-alone application, in a small .exe that would take up minimal system resources. Do you have VB Studio? If yes, I can tell you how to do it. If no, I could do it for you and mail it, if you mail me your address... unless someone knows better and enlighten us on how to use a timer control in Excel. Nikos "Mark" wrote in message ... I'd like know exactly moment increase amount files (2) in folder. Maybe vba don't have tools to do it or any tool very load memory. Regards Mark -----Original Message----- 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 . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
check folder event
Look at Chip Pearson's page on Application.OnTime to run your macro
http://www.cpearson.com/excel/ontime.htm -- Regards, Tom Ogilvy "Mark" wrote in message ... I'd like know exactly moment increase amount files (2) in folder. Maybe vba don't have tools to do it or any tool very load memory. Regards Mark -----Original Message----- 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 . |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
check folder event
Tom,
That's great, it wouldn't feel right if there wasn't a way. Thanks to both you and Chip. Nikos "Tom Ogilvy" wrote in message ... Look at Chip Pearson's page on Application.OnTime to run your macro http://www.cpearson.com/excel/ontime.htm -- Regards, Tom Ogilvy "Mark" wrote in message ... I'd like know exactly moment increase amount files (2) in folder. Maybe vba don't have tools to do it or any tool very load memory. Regards Mark -----Original Message----- 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 . |
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) | |||
How to check if a file exists in an ftp folder | Excel Discussion (Misc queries) | |||
How to check if a folder/directory exist using VBA | Excel Programming | |||
check if file is in particular folder | Excel Programming |