本文介绍了自动化错误-灾难性故障EXCEL VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一本工作簿在打开时抛出此错误.当它打开并且我打开VBA模块时,当前行是一个子程序的定义.但是唯一的选择是杀死整个Excel过程.

I have a workbook which is throwing this error on opening. When it does and I open the VBA module, the current line is the definition of a sub. But the only option is to kill the whole Excel process.

我具有自定义文档属性,具有嵌入式组合框控件,不知道它可能是什么,而Excel却无济于事.

I've got custom document properties, I've got embedded combo-box controls, I have no clue what it might be, and Excel isn't helping.

但是,当我在另一台计算机上打开同一文件时,它不会引发错误.

However, when I open the same file on another computer - it doesn't throw the error.

有人对这种错误有任何经验或建议吗?

Does anyone have any experience or advice with this kind of error?

这里是Open代码,但是发生错误时,"Show Next Statement"命令没有指向此处:

Here's the Open code, but the 'Show Next Statement' command doesn't point here when the error occurs:

````

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实例被作为后台进程打开(后台进程先前已打开有问题的文件,因此一定与之有关).一旦我关闭了另一个实例,问题就消失了.

I had this message earlier today and it was due to another instance of Excel being open as a background process (the background process had previously opened the file in question, so it must have been something to do with that). Once I closed the other instance the problem disappeared.

可能值得检查任务管理器">后台进程",以了解情况是否如此.

It might be worth checking 'Task Manager' > 'Background processes' to see if that's the case.

这篇关于自动化错误-灾难性故障EXCEL VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:46