在工作表SelectionChange事件中,我设置了:

Application.Interactive = False
.... do work
Application.Interactive = True


出于某种原因,即使我知道代码正在执行,Interactive也不会恢复为true。

Excel 2013

有任何想法吗?

最佳答案

Sub Main()

    Debug.Print Application.Interactive
    Application.Interactive = False
    Debug.Print Application.Interactive
    Application.Interactive = True
    Debug.Print Application.Interactive

End Sub


不会为我失败...尝试然后see more here

既然您发现了得出结论失败的原因,可能是因为Application.Volatile模式会阻塞用户界面,并且Interactive根据用户来计算内容,因此需要在使用Volatile的函数上将设置为false。输入。当用户输入被阻止时,您不能期望有一个函数可以评估用户输入是否起作用。一个排除另一个-希望有意义。

此外,请检查您的on error resume nexton error goto <label>语句,因为这会导致跳过某些代码,因此Application.Interactive = True将永远不会执行。

09-17 20:50