Forum Discussion

wiens's avatar
wiens
Brass Contributor
Jun 23, 2025
Solved

Invalid procedure call or argument (VBA Error 5 Excel) in Build 19011.20000

Version 2507 (Build 19011.20000) gives the following VBA error in Excel: "Invalid procedure call or argument (Error 5)"

It stops at the following line in VBA:
===

qv_wiel = WorksheetFunction.Min(3 * wiellast / (2 * Pi * Sqr(Sqr((x_wiel - x0) ^ 2 + (y_wiel - y0) ^ 2) ^ 2 + H_eq ^ 2) ^ 2) * Cos(WorksheetFunction.Radians(WorksheetFunction.Degrees(Atn(Sqr((x_wiel - x0) ^ 2 + (y_wiel - y0) ^ 2) / H_eq)))) ^ 3, wiellast * 4 * (1 / 4 - 1 / (2 * Pi) * (WorksheetFunction.Asin(2 * H_eq * Sqr((4 * H_eq ^ 2 + L_strook ^ 2 + B_strook ^ 2) / ((4 * H_eq ^ 2 + L_strook ^ 2) * (4 * H_eq ^ 2 + B_strook ^ 2)))) - 2 * H_eq * L_strook * B_strook / Sqr(4 * H_eq ^ 2 + L_strook ^ 2 + B_strook ^ 2) * (1 / (4 * H_eq ^ 2 + L_strook ^ 2) + 1 / (4 * H_eq ^ 2 + B_strook ^ 2)))) / (B_strook * L_strook))

===
This issue didn't exist in Version 2506 (May 2025) and lower.

  • This bug has been resolved. I have done a clean installation of Windows and Office.

6 Replies

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

    Are you sure the inputs for this calculation are exactly the same between those two versions you mentioned?

    Because of the large number of operations in this single statement it will be rather hard to find out which part is failing. Perhaps you can split it into multiple calculation steps?

    • wiens's avatar
      wiens
      Brass Contributor

      I have traced the error back to the source in a smaller formula. In the attached file, the following code has been added in the macro in the file.

       

      ===

      Sub test()

      x_wiel = 0

      x0 = 0

      y_wiel = 0

      y0 = 1

      f = (x_wiel - x0) ^ 2 + (y_wiel - y0) ^ 2

      MsgBox SQR(f)

       

      End Sub

      ===

       

       

      This is not correct, f is not -1 but f is actually +1. The square root of a negative number gives the VBA error 5. This is now a major calculation error in Excel.

       

       

       

       

    • wiens's avatar
      wiens
      Brass Contributor

      I have traced the error back to the source in a smaller formula. The following code has been added in the macro in the file.

       

      ===

      Sub test()

      x_wiel = 0

      x0 = 0

      y_wiel = 0

      y0 = 1

      f = (x_wiel - x0) ^ 2 + (y_wiel - y0) ^ 2

      MsgBox SQR(f)

       

      End Sub

      ===

       

       

      This is not correct, f is not -1 but f is actually +1. The square root of a negative number gives the VBA error 5. This is now a major calculation error in Excel.

       

       

       

       

Resources