例外:Microsoft Excel已停止工作

时间:2017-03-09 10:23:14

标签: excel excel-vba vba

在Windows PC(台式机,笔记本电脑)中有一个完美运行的应用程序。但是,当我尝试在Surface中运行此应用程序时,它会在下面给出错误。

Microsoft stopped working

我调试了代码,它在我们尝试锁定单元格的代码中出错。

userinput

当代码执行以下行时,它将停止工作。

Public Function temp1()
ActiveSheet.Unprotect "pswd"
ActiveSheet.EnableSelection = xlUnlockedCells
        Sheets("Travel_Requisition").Range("B" & "2", "S" & "105").Locked = True
        Sheets("Travel_Requisition").OptionButton12.Enabled = False
        Sheets("Travel_Requisition").OptionButton13.Enabled = False
        ActiveSheet.Protect Password:="?Inapune2007", DrawingObjects:=False, _
        Contents:=True, Scenarios:=True

End Function

0 个答案:

没有答案