没有断点的宏停止

时间:2016-10-31 13:19:26

标签: excel vba excel-vba

我开发了一个在我的计算机上正常运行的宏。但是当我有预期的最终用户在他们的计算机上运行宏时,即使没有断点,它也会在同一行代码中断开。相关代码如下:

Function MMFProcessor(Source_Folder_Str As String, Input_File_Name As String, Output_Sheet As Worksheet, NPU As String, Prods As String, sw As StatWin, _
    Processed_Members_Str As String, MbrRow_Dict() As String, FlgMeas() As String, Output_Sheet_Row As Long, Output_Mbr_Key_Col As String, Output_Name As String, _
    Optional Ambetter As Boolean = False) As Variant()
'
Dim Source_WB As Workbook
Set Source_WB = Workbooks.Open(Source_Folder_Str & "\" & Input_File_Name & ".xlsx", , True)
Dim Input_Mbr_Key_Col As String
Dim Input_Product_Col As String
Dim Input_SubMsr_Col As String
Dim ret As Boolean
ret = True
Dim Return_Array(4) As Variant
Dim Found As Boolean
Dim Source_Col_Nbr As Integer
Dim NumerCnt_Col As String
Dim SourceFile_Col_Cnt As Long
SourceFile_Col_Cnt = Count_Columns(Source_WB.Worksheets(1))
Dim Col_Str As String

'Set/Reset sw.Input_Sorted
sw.Input_Sorted = False '*****THIS IS THE LINE THAT CATCHES*********

If sw.Detailed_Log Then
    Call Update("Starting MMFProcessor. Inputs: Source_Folder_Str= " & Source_Folder_Str & "; Input_File_Name= '" & Input_File_Name & "'; Output_Sheet= '" & Output_Sheet.Name & _
        "'; Output_Sheet_Row= '" & Output_Sheet_Row & "'; Mbr_Key_Col= '" & Output_Mbr_Key_Col & "'; Output_Name= '" & Output_Name & "'", 0, sw)
End If

Stat_Win是一个自定义表单,我将它放在一起作为宏的状态窗口。 Input_Sorted变量确实存在并且是布尔值。运行宏的另一个人拥有相同版本的Excel,对正在使用的文件夹的访问权限,并且在我能想到的任何方面基本相同。

任何关于系统设置中的非明显差异的任何帮助或代码可能捕获的任何其他原因(我没有提及)都会非常感激。

1 个答案:

答案 0 :(得分:6)

It sounds like a ghostbreak。这是那些解决方案:

  1. 按"调试"弹出窗口中的按钮。
  2. 按两次 Ctrl + Pause | Break
  3. 点击播放按钮继续。
  4. 完成后保存文件..