Any luck with this?
Any luck with this?
Sorry but that code appears to be all over the place.![]()
You seem to be running subs from other subs then calling back to those subs again.
Threads merged. luv2glyd, please don't do that.
Routine A calls B and C
Routine B calls A
Routine C calls A
So the stack gets deeper until it overflows.
I don't think anyone could help without having a clue as to what you're trying to do, and seeing the six missing routines.
1. You have not declared and typed your variables, so VB is assigning them the default type of Variant (16 bytes vs 2 for Integer and 4 for Long)
2. The variable intrade is used in each of the three procedures and it appears that you intended to have the value accessed and changed by each of the three variables; but, since it is undeclared, each procedure initializes a local variable of 16 byte Variant-type with no link to any previous value each time the procedure is called. You should declare it as Public at the top of the module (outside any procedure) and type it as Integer.
3. You are using "application.run..." to run code in each module, instead, use CALL procedure name.
4. In your sub procedures, you are trying to exit the procedure and return to the main procedure by using the App...run.. language; however, this will only call the main as a subroutine of the calling subroutine and start it from the beginning of the code. Since main is calling each of the subs, you have an untended infinite loop that crashes Excel. If you had CALLed the sub from the main, the End Sub would exit the sub and return to the main at the next line after the CALL line:
![]()
Public intrade as Integer sub main() .... do some stuff .... call function_one return here from function one and do more stuff call function_two return here from function two, etc end sub sub function_one() do something end sub sub function_two() ... end sub
Declare & Type all variables
Use Call vs. app/run
Ben Van Johnson
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks