Application.Interactive = True失败

时间:2013-11-01 11:08:58

标签: excel vba excel-vba

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

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

由于某些原因,即使我知道代码正在执行,Interactive也没有被设置为true。

Excel 2013

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

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需要在使用它的函数上设置为false,因为Interactive模式会阻止用户界面和{ {1}}根据用户输入计算内容。当用户输入被阻止时,您不能指望评估用户输入的函数能够工作。一个人排除另一个人 - 希望这是有道理的。

此外,检查您的Volatileon error resume next语句会导致跳过某些代码,因此on error goto <label>永远不会被执行。

相关问题