Runtime Error 49, Bad DLL calling convention

后端 未结 8 1755
闹比i
闹比i 2020-12-29 12:10

Q. Excel keeps throwing the following error, whenever my addin is loaded (Runtime Error 49, Bad DLL calling convention)

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 12:34

    In my case this was "caused" by an excessive use of the continue character _ in a single if conditional

    I had already recompiled, checked all return codes, moved modules around ,restarted excel , restarted my computer, copied the code to a brand new Excel spread-sheet, I read this article and the bit about return codes made me think about how many returns can be in an if statement

    I had this

        If CompressIntoOneLineON(rg1, rgstart, rgend) or _
           CompressIntoOneLineOS(rg1, rgstart, rgend) or _
           CompressIntoOneLineOGN(rg1, rgstart, rgend) or _
           CompressIntoOneLineOGS(rg1, rgstart, rgend) or _
           CompressIntoOneLineGO(rg1, rgstart, rgend) Then
           
        End If
    

    I was getting the error when the subroutine containing this code exited So I changed to this

    matched = True
    If CompressIntoOneLineON(rg1, rgstart, rgend) Then
    ElseIf CompressIntoOneLineOS(rg1, rgstart, rgend) Then
    ElseIf CompressIntoOneLineOGN(rg1, rgstart, rgend) Then
    ElseIf CompressIntoOneLineOGS(rg1, rgstart, rgend) Then
    ElseIf CompressIntoOneLineGO(rg1, rgstart, rgend) Then
    Else
      matched = False
    End If
    if matched then
      
    

    and the error went away

提交回复
热议问题