PC Review


Reply
Thread Tools Rate Thread

Application.Quit out of Do loop

 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      4th Jun 2007
While doing some housekeeping on some old VBA procedures, I stumbled on this
anomaly of Application.Quit not executing out of a Do loop. Just wondered if
someone can explain why it is necessary to Exit Do before the Quit method
will execute?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmVuIE1jQmVu?=
Guest
Posts: n/a
 
      5th Jun 2007
VBA's ability, on the odd occaision, to obfuscate what must be underlying
machine code logic, to a mirage of strange magic, leaves me stunned- Just as
well we love it eh?

"JLGWhiz" wrote:

> While doing some housekeeping on some old VBA procedures, I stumbled on this
> anomaly of Application.Quit not executing out of a Do loop. Just wondered if
> someone can explain why it is necessary to Exit Do before the Quit method
> will execute?

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      5th Jun 2007
See the difference of commenting out the DoEvents.

Private Sub CommandButton1_Click()
Dim i As Long, j As Long

For i = 1 To 100000
For j = 1 To 100000
If i = 500 And j = 1000 Then Application.Quit
Next
Debug.Print i, j
DoEvents
Next

End Sub

NickHK

"JLGWhiz" <(E-Mail Removed)> wrote in message
news:716C9527-6E78-4F3E-800C-(E-Mail Removed)...
> While doing some housekeeping on some old VBA procedures, I stumbled on

this
> anomaly of Application.Quit not executing out of a Do loop. Just wondered

if
> someone can explain why it is necessary to Exit Do before the Quit method
> will execute?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.Quit / DoCmd.Quit Fails Ajandco Microsoft Access VBA Modules 4 24th Aug 2007 11:22 PM
Application.Quit / DoCmd.Quit Fails Keith Microsoft Access Form Coding 15 5th Jun 2007 07:33 PM
How to quit from a loop ? javiernews via AccessMonster.com Microsoft Access VBA Modules 3 20th Dec 2006 05:10 PM
DoCmd.Quit vs. Application.Quit MikeC Microsoft Access VBA Modules 2 6th Oct 2004 05:08 AM
macro to close excel application other than application.quit mary Microsoft Excel Programming 1 14th Sep 2004 03:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:07 PM.