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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 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
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 20th 07 11:16 PM
Check if a folder has x files in it. Dave Excel Discussion (Misc queries) 8 November 15th 07 03:35 PM
How to check if a file exists in an ftp folder LL Cool A Excel Discussion (Misc queries) 3 May 16th 06 09:22 PM
How to check if a folder/directory exist using VBA wellie Excel Programming 1 March 1st 04 02:24 AM
check if file is in particular folder nikolaosk[_10_] Excel Programming 2 October 18th 03 04:25 PM


All times are GMT +1. The time now is 09:59 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"