What gives... Application.Interactive = false

K

Kieranz

Hi all,
I have the following code...
Sub testInterActive()
Dim x As Integer
Application.Interactive = False
For x = 1 To 10000
Range("C12").Value = x
Next x
MsgBox "Long procedure completed"
Application.Interactive = True
End Sub

What happens is that whilst the long procedure is running and you
happen to punch couple of keys followed by "Enter" key, at the end of
the procedure those keys that you punched are recorded on to the
sheet. PS keep punching couple of more times whilst the procedure is
running and remember to press "Enter" after each punch attempt. The
Msgbox also does not appear.
Qn. What gives or is happening? And how do you prevent this?
Many thks. Rgds KZ
 
J

Jean-Yves

The fact to Hit the Enter Key,
On enter key hit also closes the messabe box.
To make your code running completely modaL
Create a userform,
Select the userform activate event.
Call your code from that event
Regards
JY
 
D

Don Guillett

try

Sub testInterActive()
Dim x As Integer
Application.EnableEvents = False
'Application.Interactive = False
For x = 1 To 300
Range("C12").Value = x
Next x
MsgBox "Long procedure completed"
'Application.Interactive = True
Application.EnableEvents = True
'MsgBox "Long procedure completed"
End Sub

Don Guillett
SalesAid Software
(e-mail address removed)
 
K

Kieranz

try

Sub testInterActive()
Dim x As Integer
Application.EnableEvents = False
'Application.Interactive = False
For x = 1 To 300
Range("C12").Value = x
Next x
MsgBox "Long procedure completed"
'Application.Interactive = True
Application.EnableEvents = True
'MsgBox "Long procedure completed"
End Sub

Don Guillett
SalesAid Software

Hi Jean and Don,
Many thks. I thought that interactive false prevents user actions?
Rgds KZ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top