I know my sample is useless. but if you don't want to eat up stack, you have
to exit a sub first, and then have to call another sub. i think your code is
something like this and this will eat up your stack.
Sub func1()
func2
End Sub
Sub func2()
func3
End Sub
Sub func3()
func1
End Sub
Though this is a one way, but with a public variable in standard module and
by manipulateing it from userform, I think you could control the sequences
of your forms coming up. this may be another useless sample. CommandButton2
is a "back" button, though it could back only one step.
run showform, though this is endless sub.
in standard module
Type fstate
nstate As Long
pstate As Long
End Type
Public fs As fstate
Sub showform()
fs.nstate = 1
fs.pstate = 1
Do
If fs.nstate = 1 Then
UserForm1.Show
ElseIf fs.nstate = 2 Then
UserForm2.Show
ElseIf fs.nstate = 3 Then
UserForm3.Show
Else
Exit Do
End If
Loop
End Sub
in UserForm1 module
Private Sub CommandButton1_Click()
Me.Hide
fs.nstate = 2
fs.pstate = 1
End Sub
Private Sub CommandButton2_Click()
Me.Hide
fs.nstate = fs.pstate
End Sub
in UserForm2 module
Private Sub CommandButton1_Click()
Me.Hide
fs.nstate = 3
fs.pstate = 2
End Sub
Private Sub CommandButton2_Click()
Me.Hide
fs.nstate = fs.pstate
End Sub
in UseFform3 module
Private Sub CommandButton1_Click()
Me.Hide
fs.nstate = 1
fs.pstate = 3
End Sub
Private Sub CommandButton2_Click()
Me.Hide
fs.nstate = fs.pstate
End Sub
keizi
> It sounds simple enough but my problem is that I can't have the forms
> in a loop because I have "back" buttons etc incase the user selects
[quoted text clipped - 3 lines]
> --
> The Zero ST
Craig Coope - 27 Apr 2007 20:09 GMT
>I know my sample is useless. but if you don't want to eat up stack, you have
>to exit a sub first, and then have to call another sub. i think your code is
[quoted text clipped - 79 lines]
>
>keizi
Thank you for your patience with me!...I'll try your suggestion over
the weekend and hopefully fit it around my program...
Cheers...
--
The Zero ST
Craig Coope - 28 Apr 2007 11:41 GMT
Thank you again and to Harlan for all your help...
I have managed to adjust the code you gave me so that my forms work
exactly as expect and now I only have one item in the call stack it
seems at all times so looks like my out of stack space is sorted...
I only have one more question now. With the code you gave me (and I
guess it makes sense by looking at it) it doesn't allow me to break
the program. Ie I can't press the X on the top right of the form.
(obviously pressing X closes the window and from the code in the
module it opens it back up again. What do I need to add to prevent
this?
Many Thanks again...
--
The Zero ST
Craig Coope - 28 Apr 2007 13:26 GMT
>Thank you again and to Harlan for all your help...
>
[quoted text clipped - 10 lines]
>
>Many Thanks again...
Never mind...Sorted it...
--
The Zero ST