Table of Contents

VBR50001: Nobody to answer

Severity: Error  ·  Family: VBR (runtime semantics), RD-VBA's own run-time errors  ·  Source metadata: VBRuntimeErrorInfo

A program run unattended opened a dialog: a MsgBox, an InputBox, or a form shown, modal or not. Nobody is there to answer it, so the run fails.

A run is unattended when the client that asked for it said so: rdc.exe --unattended, the CLI.Unattended setting, or any client that expects the Unattended capability of the platform (a CI job, a script). The dialogs are part of the standard library, which every program has; a client that doesn't answer them opts out of them. It doesn't opt in to them.

The error is untrappable. The run fails whatever error handler the program has: On Error Resume Next doesn't swallow it, and On Error GoTo doesn't reach its handler. A run nobody watches has to fail loudly, not wait for an answer that never comes, or carry on with one nobody gave. Its line, its stack trace and its code are reported as for any other unhandled run-time error.

The number

RD-VBA's own run-time errors are numbered VBR50000 to VBR50999. They are errors MS-VBA has no number for. The family follows whoever raised the error (RD-VBAL §2.6.3):

  • VBR50001 is the runtime's;
  • a program's own Err.Raise 50001 is an application error, VBA50001.

The two are never the same error. A program can't catch VBR50001, so no code of a program reads its number.

How it is raised

Situation Example Resolution
A MsgBox in a program run unattended MsgBox "Done" in a script a CI job runs with rdc.exe --unattended Write to the output instead (Debug.Print), or have the test that runs the code replace the dialog.
An InputBox in a program run unattended name = InputBox("Name?") Give the program its input another way: an argument, a file, a constant of the test.
A form shown in a program run unattended, modal or not, in the process or through an external host UserForm1.Show, UserForm1.Show vbModeless Keep the form out of the code the unattended run reaches, or run the program attended.
A dialog the client that shows the program's dialogs declined to answer An IDE that expects SessionInteraction answers a MsgBox with handled: false The client answers the dialogs it said it shows. A host started by the language server is seen by nobody, so it shows no dialog of its own instead.

A unit test framework that mocks MsgBox and InputBox intercepts them before they open. A run that reaches this error has a dialog that nothing intercepted.

See also


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca