msgbox exit from a loop


Posted by CHUCK on April 12, 2000 4:22 PM

how can i exit a loop with msgboxin it which i use for debugging.

this little marco is an example

Sub t_msgbox()

X = 5
For A = 1 To 100
Z = X + 2
MsgBox Z, 2, "Z"
X = X + 2
Next A
End Sub

thanks for any help Chuck

Posted by Celia on April 12, 2000 5:05 PM

Chuck
Try this :-

Sub t_msgbox()
Dim Response As Integer
X = 5
For A = 1 To 100
Z = X + 2
Response = MsgBox(Z, 2, "Z")
If Response = vbAbort Then
Exit Sub
Else
X = X + 2
End If
Next A
End Sub

Celia



Posted by chuck on April 13, 2000 1:04 PM

+Thanks Chuck