Microsoft KB Archive/213301

= XL2000: Application.Interactive Value Not Reset When Macro Stops =

Article ID: 213301

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q213301





SYMPTOMS
The Application.Interactive value does not reset itself to a default value after the end of the macro is reached.



CAUSE
The Interactive property of the Application object allows a macro to block all user input from both the keyboard and the mouse. The property is useful in situations where user input has the potential to disrupt macro operations. However, unlike most of the read/write properties of the Microsoft Excel Application object, Application.Interactive does not reset itself to a default value after the end of the macro is reached. Because of this, if the Interactive property is not reset to a True value in the code of the macro, or an error occurs during execution of the macro, Excel does not respond to user input even though the macro has technically stopped executing.



RESOLUTION
If you forget to reset the property to True, or encounter an error in the execution of the code, shut down that instance of Microsoft Excel and fix the line of code that caused the error.

To do this, press CTRL+ALT+DELETE and end the Microsoft Excel task.

Sample Visual Basic Procedure
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

If it is necessary to enable user input to Microsoft Excel without restarting the program, you can reset the property, using Automation, through a Visual Basic for Applications macro.

NOTE: The success of the following macro depends on the ability to open a separate instance of Excel. In Excel 2000, you cannot start a separate instance of Excel, and therefore must run the macro from another program.

The method for opening a separate instance of Excel varies, depending on the operating system.

Windows 2000

 * 1) Click Start, and then click Run.
 * 2) Type the full path to Microsoft Excel in the Open box -- for example, c:\Excel\Excel.exe -- and then press ENTER.
 * 3) Point to Macro on the Tools menu, and then click Visual Basic Editor.

After starting a separate instance of Microsoft Excel, follow these steps:  On the Insert menu, click Module.  Type the following code in the Module sheet. Sub reset_interactive

Dim xlobj As Object

' The GetObject method will access the open instance of Microsoft ' Excel, not a new one. Set xlobj = GetObject("Book1")

' Where book1 is the name of the Workbook that has stopped ' responding to user input. Make sure to leave the extension, ' .xls, .xlt, and so on, off. ' Because the above line assigns the first Worksheet of book1 to  ' xlobj, we must access the Application property of the object in   ' order to reset the Interactive property.

xlobj.Application.Interactive = True

End Sub  To run the macro, click the insertion point in the macro code, and then press F5.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

