自动化错误 – 灾难性故障EXCEL VBA

我有一个工作簿是在开放时抛出这个错误。 当它和我打开VBA模块时,当前行是一个子的定义。 但唯一的select是杀死整个Excel进程。

我有自定义的文档属性,我有embeddedcombobox控件,我不知道它可能是什么,Excel不帮助。

但是,当我在另一台计算机上打开同一个文件时,它不会抛出错误。

有没有人有这种错误的经验或build议?

这里是Open代码,但是当出现错误时,'Show Next Statement'命令不会指向这里:

““

Private Sub Workbook_Open() Dim ans If Range("currentstatus") Like "*Ready for Year-End Preparation*" Then ans = MsgBox("This workbook is ready for Year-End Preparation" & vbCrLf & "Would you like to begin?", vbYesNo) If ans = vbYes Then Range("Phase") = "Year-End" SheetsSet 3 End If End If 'Exit Sub If Range("Phase") = "Commissions" Then If Range("currentstatus") Like "*RVP/Dept Head Approved*" Then ans = MsgBox("Commissions have been approved for " & Range("applicablemonth") & vbCrLf & "Would you like to enter data for the new period?", vbYesNo + vbQuestion) If ans = vbYes Then Range("ApplicableMonth") = Format(DateAdd("m", 1, CVDate(Range("applicablemonth"))), "YYYY-MM") Range("CurrentStatus") = "Ready for Data Entry for " & Range("ApplicableMonth") ' now reset the summary page Prot False, "Commission Form Summary" Range("SalesPersonComplete") = Range("Summary") Range("RVPComplete") = "" Range("BrMgrComplete") = "" Prot True, "Commission Form Summary" Sheets("Menu").Select ' MsgBox "Begin." End If End If End If End Sub 

我今天早些时候有这个消息,这是由于另一个Excel实例作为后台进程打开(后台进程之前已经打开有问题的文件,所以它一定是有关的)。 一旦我closures另一个实例,问题就消失了。

这可能是值得检查“任务pipe理器”>“后台进程”,看看是否是这样的情况。

仔细检查您的文件扩展名。 embeddedmacros的Excel电子表格需要* .xlsm扩展名,而不是* .xls。

总共'傻瓜'的答案,但我自己犯了这个错误。