I don't know what your called routine is doing. It may be the cause of the problem. Infinite loops can be costly in memory usage.
DoEvents can sometimes help.
I like to give an out for infinite loops. This can let your code reset some things.
e.g.
For what you are doing, I would use a vb.net program and watch a folder. When the text file shows up, it would do what is needed or call a program that does it. There are some vba examples that watch folders but usually take more of a performance hit than the vb.net route.Sub InfiniteLoop() Dim n As Integer Application.EnableCancelKey = xlErrorHandler n = 0 MsgBox "WARNING: This macro will cause an infinite loop. Press" & _ " CTRL+BREAK to exit an infinite loop." On Error GoTo EndNow Do ' Because the "Do...Loop" is looking for the value of 'n' ' to equal 1, and because there is no code within the loop ' to change the value of the variable 'n' from it's initial ' value of zero, the "Do...Loop" will continue to loop indefinitely. Loop Until n = 1 EndNow: End Sub




Reply With Quote