Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Application.Interactive Value Not Reset When Macro Stops


View products that this article applies to.

This article was previously published under Q213301

↑ Back to the top


Symptoms

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

↑ Back to the top


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.

↑ Back to the top


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 Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

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:
  1. On the Insert menu, click Module.
  2. 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
    					
  3. To run the macro, click the insertion point in the macro code, and then press F5.

↑ Back to the top


Status

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

↑ Back to the top


References

For more information about the Interactive property, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type interactive property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB213301, kbprogramming, kbpending, kbdtacode, kbbug

↑ Back to the top

Article Info
Article ID : 213301
Revision : 8
Created on : 11/23/2006
Published on : 11/23/2006
Exists online : False
Views : 310