Macro stopping without breakpoint [duplicate]

2020-02-15 09:07发布

I developed a macro that is running fine on my computer. But when I have the intended end user run the macro on their computer it keeps breaking at the same line of code even though there's no breakpoint. The relevant code is below:

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 is a custom form that I put together to serve as a status window for the macro. The Input_Sorted variable does exist and is a Boolean. The other person running the macro has the same version of Excel, access rights to the folders being used, and is basically the same in any respect that I can think of.

Any help on non-obvious differences in system setup or any other reason the code might be catching that I haven't mentioned would be much appreciated.

1条回答
神经病院院长
2楼-- · 2020-02-15 10:05

It sounds like a ghostbreak. This is the solution for those:

  1. Press "Debug" button in the popup.
  2. Press Ctrl+Pause|Break twice.
  3. Hit the play button to continue.
  4. Save the file after completion..
查看更多
登录 后发表回答