We beat window-closing to death in December, and before that in
September. Here's some code I started and John Roberts fixed which
closes windows until they're all closed, or until the CancelClose event
of a window returns true.
Charles Yeomans
----------------------------------------------------------
Function CloseAllWindows() as Boolean
dim loopSentinel as Integer
loopSentinel= WindowCount
While (WindowCount > 0) and (loopSentinel = WindowCount)
Window(0).Close
loopSentinel = loopSentinel - 1
Wend
Return (loopSentinel = WindowCount)
End Function
On Wednesday, February 27, 2002, at 03:25 PM, Kevin Rudman wrote:
on 27/2/02 7:21 pm, Terry Hulseberg at RB at Hulseberg dot com wrote:
Dim i As Integer
For i = WindowCount downTo 1
window(WindowCount-1).close
next
Perhaps better to do:
Dim i, n As Integer
n = WindowCount-1
For i = n DownTo 0
window(i).close
Next
That way you evaluate WindowCount once only and avoid tinkering with the
loop count evaluation from within the loop, which makes things clearer,
if
not less dangerous too!
Kevin Rudman
|