RDC11041: Str of an Error value
Severity: Warning · Family: RDC (Rubberduck Core analyzers) ·
Raised by: NumberTextAnalyzer
Str or Str$ is given an Error value made by CVErr.
VBA raises run-time error 13 (Type mismatch) for it. MS-VBAL §6.1.2.3.1.20 returns the text "Error " followed by the error code, as
CStr does ("Error 5"). RD-VBA raises 13 as Microsoft Office VBA does, and this warning marks the call that raises it.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| The text of an error value is wanted. | Debug.Print Str(CVErr(5)) |
Use CStr: CStr(CVErr(5)) is "Error 5". |
| The error code is wanted. | Str(CVErr(code)) |
Write the code itself: Str(code). |
See also
- RD-VBAL §2.6.4 Rubberduck Core Diagnostics
- RD-VBAL §6.1.2.3 Conversion Module
RDC11040:Strof a number between -1 and 1
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca