ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OUT OF STACK SPACE ERROR (https://www.excelbanter.com/excel-programming/407676-out-stack-space-error.html)

[email protected]

OUT OF STACK SPACE ERROR
 
I get an error everytime I run this.
I need to find a way to avoid the error but still keep my program
running.
can anyone help me plz?


Dim sngtime

sub test()

Range("A11").select
Application.run "test.xls!sheet1.test"
sngtime = timer + 1.5
do while timer < sngtime
doevents
loop
application.run "test.xls!sheet1.test"

end sub

James Snell

OUT OF STACK SPACE ERROR
 
(Hint) Your code is recursive, and it's going to go straight into an infinite
loop.

The code will execute like this...

Range("A11").select
Application.run "test.xls!sheet1.test"
Range("A11").select
Application.run "test.xls!sheet1.test"
Range("A11").select
Application.run "test.xls!sheet1.test"
...
...


It will never get beyond those lines. You'll need to rework your code.
I'll give you a hint later :)


" wrote:

I get an error everytime I run this.
I need to find a way to avoid the error but still keep my program
running.
can anyone help me plz?


Dim sngtime

sub test()

Range("A11").select
Application.run "test.xls!sheet1.test"
sngtime = timer + 1.5
do while timer < sngtime
doevents
loop
application.run "test.xls!sheet1.test"

end sub



All times are GMT +1. The time now is 08:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com