Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Polling directory for changes

Hi There,

I would like to verify whether there are changes on a certain
text-file.
Dave P. gave a link to the site of Randy Birch where he has some code
which does -i think- exactly what I would like to test.

I created the Userform ...Commandbuttons ..labels ...as he suggested.
But do not succeed to get any data in it.
Is it not possible to fire this code in Excel97 SR2? Why?
If possible: How?

Sige


Van:Dave Peterson
Onderwerp: Polling a directory for changes with Excel
Datum:2002-03-01

I'm not quite sure if this is what you want, but you can get some code
from
Randy Birch's VBNet site to use API
calls to watch a folder.

Go to http://www.mvps.org/vbnet/ and
search for FindChangeNotification.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Polling directory for changes

If I recall correctly, Randy Birch uses a userform (albeit VB, not VBA) to show
how this works.

You may want to post more info about what you tried. (I remember it working in
2002 when I was using xl97 SR2 and win98.)



SIGE wrote:

Hi There,

I would like to verify whether there are changes on a certain
text-file.
Dave P. gave a link to the site of Randy Birch where he has some code
which does -i think- exactly what I would like to test.

I created the Userform ...Commandbuttons ..labels ...as he suggested.
But do not succeed to get any data in it.
Is it not possible to fire this code in Excel97 SR2? Why?
If possible: How?

Sige

Van:Dave Peterson
Onderwerp: Polling a directory for changes with Excel
Datum:2002-03-01

I'm not quite sure if this is what you want, but you can get some code
from
Randy Birch's VBNet site to use API
calls to watch a folder.

Go to http://www.mvps.org/vbnet/ and
search for FindChangeNotification.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Polling directory for changes

Hi Dave,
-I created the Userform like Randy says with the Commanbuttons, labels
and listbox on it.
-Put all his code into the userform
-Changed just the "d:\dummy"-directory to mine ...

And just now managed to get it working ...At least: Sort of!!!
Problem is/was:

Randy uses -I guess it is VB- :
eg:
-Private Sub Command1_Click() (obviously also for 2 and 3)
-List1

While the VBA requires:
-Private Sub CommandButton1_Click()
-ListBox1

= The VB-names (like Command1_Click) are not compatible with VBA?
Is there maybe a reference to set, so VBA understands the VB
"completely"?

= I managed to get it working: ie it polls for every change made on the
specific text-file...Instantaneously: in nano-seconds ;o) !

***BUT*** it is nearly impossible for me to "Stop Watching"/stop the
polling ...or to End (unload) the Userform ... Excel behaves a bit like:
not-responding, it sort of "hangs", "stalls".
Only after 4-5 minutes, the userform will "Stop Watching" or "End".
== Why?

Sige


"NOSPAM" to be removed for direct mailing...

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Polling directory for changes

I don't know of any cross-reference document for VB to VBA.

I just found the workbook I used in 2001. I didn't have the same problem as
you.

If you want, I can email it to you to test.



SIGE wrote:

Hi Dave,
-I created the Userform like Randy says with the Commanbuttons, labels
and listbox on it.
-Put all his code into the userform
-Changed just the "d:\dummy"-directory to mine ...

And just now managed to get it working ...At least: Sort of!!!
Problem is/was:

Randy uses -I guess it is VB- :
eg:
-Private Sub Command1_Click() (obviously also for 2 and 3)
-List1

While the VBA requires:
-Private Sub CommandButton1_Click()
-ListBox1

= The VB-names (like Command1_Click) are not compatible with VBA?
Is there maybe a reference to set, so VBA understands the VB
"completely"?

= I managed to get it working: ie it polls for every change made on the
specific text-file...Instantaneously: in nano-seconds ;o) !

***BUT*** it is nearly impossible for me to "Stop Watching"/stop the
polling ...or to End (unload) the Userform ... Excel behaves a bit like:
not-responding, it sort of "hangs", "stalls".
Only after 4-5 minutes, the userform will "Stop Watching" or "End".
== Why?

Sige

"NOSPAM" to be removed for direct mailing...

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Polling directory for changes

Hi Dave,

I tried it with a couple of other codes from Randy as well ...
If I do not change eg. Command1_Click to CommandButon1_Click
The code simply does not work ...

Look forward to receive your file Dave!

Sige

"NOSPAM" to be removed for direct mailing...

*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Polling directory for changes

Hi Sige,

-I created the Userform like Randy says with the Commanbuttons, labels
and listbox on it.
-Put all his code into the userform
-Changed just the "d:\dummy"-directory to mine ...

And just now managed to get it working ...At least: Sort of!!!
Problem is/was:

Randy uses -I guess it is VB- :
eg:
-Private Sub Command1_Click() (obviously also for 2 and 3)
-List1

While the VBA requires:
-Private Sub CommandButton1_Click()
-ListBox1

= The VB-names (like Command1_Click) are not compatible with VBA?
Is there maybe a reference to set, so VBA understands the VB
"completely"?


Yes VB buttons are named Command# by default. It's not a problem - just
rename your buttons same, as per the instructions given by Randy under "Form
Code" on his page. In your form module you could "Replace" all "Command"
with "CommandButton", but that's more convoluted. Similarly with other named
controls like "List#" vs "ListBox#"


***BUT*** it is nearly impossible for me to "Stop Watching"/stop the
polling ...or to End (unload) the Userform ... Excel behaves a bit like:
not-responding, it sort of "hangs", "stalls".
Only after 4-5 minutes, the userform will "Stop Watching" or "End".
== Why?


I tried Andy's code in XL97 & XL2K. In XL97 I also had a problem to "Stop
Watching". However I changed the following line in "Command1_Click"

watchStatus = WatchResume(hWatched, 100)
to
watchStatus = WatchResume(hWatched, 400)

Maybe need a few button clicks but now it stops OK. In XL2K leaving the
interval at 100 works just fine for me on the same machine - instant stop. I
have no idea why the difference in XL97 vs XL2K.

During the Loop "DoEvents" allows other events - such as the button click to
stop the watch - to fire. For my purposes in my own app this is exactly what
I DON'T want! But that's another issue.

Regards,
Peter T

PS: the direct link to Randy's code is he
http://vbnet.mvps.org/code/fileapi/watchedfolder.htm


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Polling directory for changes

Hi Peter,

Thx for the solution ...got an "instant stop" now as well!

Sige :o)



"NOSPAM" to be removed for direct mailing...

*** Sent via Developersdex http://www.developersdex.com ***
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Polling directory for changes

Glad you found the solution. I won't send that other workbook.

(ok?)

SIGE wrote:

Hi Peter,

Thx for the solution ...got an "instant stop" now as well!

Sige :o)

"NOSPAM" to be removed for direct mailing...

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
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
Directory Jeff Excel Discussion (Misc queries) 1 October 5th 06 04:51 PM
set last used for getting directory smokiibear Excel Programming 8 December 15th 04 07:38 PM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
Directory Code Bill Vernon Excel Programming 3 February 28th 04 11:52 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 04:02 AM.

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

About Us

"It's about Microsoft Excel"