From 55487afe51ed302656682038bba7a19f8b985e75 Mon Sep 17 00:00:00 2001 From: Kuba Sunderland-Ober Date: Tue, 27 Oct 2026 19:14:53 +0100 Subject: [PATCH 01/16] Errors batch 7: files harness, data and Common Errors sections for the FileSystem module --- docs/Documentation/Tools-Defects.md | 2 +- .../Reference/Default/VBA/FileSystem/ChDir.md | 16 +- .../Default/VBA/FileSystem/ChDrive.md | 16 + .../Default/VBA/FileSystem/CurDir.md | 22 + docs/Reference/Default/VBA/FileSystem/Dir.md | 27 +- docs/Reference/Default/VBA/FileSystem/EOF.md | 12 +- .../Default/VBA/FileSystem/FileAttr.md | 19 +- .../Default/VBA/FileSystem/FileCopy.md | 34 +- .../Default/VBA/FileSystem/FileDateTime.md | 25 +- .../Default/VBA/FileSystem/FileLen.md | 25 +- .../Default/VBA/FileSystem/FreeFile.md | 13 + .../Default/VBA/FileSystem/GetAttr.md | 25 +- .../Reference/Default/VBA/FileSystem/Input.md | 25 + .../Default/VBA/FileSystem/InputB.md | 22 + docs/Reference/Default/VBA/FileSystem/Kill.md | 33 +- docs/Reference/Default/VBA/FileSystem/LOF.md | 12 +- docs/Reference/Default/VBA/FileSystem/Loc.md | 12 +- .../Reference/Default/VBA/FileSystem/MkDir.md | 15 +- .../Reference/Default/VBA/FileSystem/RmDir.md | 17 +- docs/Reference/Default/VBA/FileSystem/Seek.md | 17 +- .../Default/VBA/FileSystem/SetAttr.md | 26 +- .../Reference/Default/VBA/FileSystem/Width.md | 25 +- .../Reference/Default/VBA/FileSystem/index.md | 2 +- docs/Reference/Run-time-Errors.md | 24 +- errors/VBA.FileSystem.yml | 894 ++++++++++++++++++ errors/harnesses/files.bas | 164 ++++ 26 files changed, 1482 insertions(+), 42 deletions(-) create mode 100644 errors/VBA.FileSystem.yml create mode 100644 errors/harnesses/files.bas diff --git a/docs/Documentation/Tools-Defects.md b/docs/Documentation/Tools-Defects.md index 057eea17f..ef9f36513 100644 --- a/docs/Documentation/Tools-Defects.md +++ b/docs/Documentation/Tools-Defects.md @@ -157,7 +157,7 @@ Exit codes: **0** the sample ran, or, with `--docs`, no fence differs and none r node scripts/errors.mjs write [...] node scripts/errors.mjs messages [--runtime tb|win64|vb6|vba64]... [--ide ] [--vb6 ] [--keep] -Measures the run-time errors each documented procedure raises, and writes each reference page's Common Errors section from them. The errors are data, not prose: a YAML file per area under `errors/` lists, for each page, the cases that raise each error and the cases that must raise nothing, and `errors/messages.yml` gives each number's message: the one `Err.Description` gives once the error is raised, and the one `Error$(number)` gives, where the two differ. The format is in `WIP.Errors.md`. Each twinBASIC build is compared with its counterpart: 32-bit twinBASIC with VB6, 64-bit twinBASIC with 64-bit VBA. A case can run under a *harness*, the code of `errors/harnesses/.bas`, one source for twinBASIC, VB6 and VBA, which the probe calls before and after the case: the `clock` harness replaces the system's clock setters in the probe's own process, so a case that sets `Date` or `Time` is measured, and the value it would set checked, without the clock being changed; `registry` removes what a case writes under the VB settings key; `dialog` answers each box `MsgBox` or `InputBox` shows the moment it opens, and refuses one that would open on another desktop; `keys` records the keys `SendKeys` would send and sends none; and `window` gives `AppActivate` a window of the probe to activate. VB6 builds a probe with cases under `dialog` without Unattended Execution, which would write the box to the event log in place of showing it. A file is named as it is in `errors/`; with none named, every file there is used. `--only ` keeps the pages whose path under `docs/` matches. +Measures the run-time errors each documented procedure raises, and writes each reference page's Common Errors section from them. The errors are data, not prose: a YAML file per area under `errors/` lists, for each page, the cases that raise each error and the cases that must raise nothing, and `errors/messages.yml` gives each number's message: the one `Err.Description` gives once the error is raised, and the one `Error$(number)` gives, where the two differ. The format is in `WIP.Errors.md`. Each twinBASIC build is compared with its counterpart: 32-bit twinBASIC with VB6, 64-bit twinBASIC with 64-bit VBA. A case can run under a *harness*, the code of `errors/harnesses/.bas`, one source for twinBASIC, VB6 and VBA, which the probe calls before and after the case: the `clock` harness replaces the system's clock setters in the probe's own process, so a case that sets `Date` or `Time` is measured, and the value it would set checked, without the clock being changed; `registry` removes what a case writes under the VB settings key; `dialog` answers each box `MsgBox` or `InputBox` shows the moment it opens, and refuses one that would open on another desktop; `keys` records the keys `SendKeys` would send and sends none; `window` gives `AppActivate` a window of the probe to activate; and `files` runs a case in a folder of its own under the temporary folder, made the current directory and filled with a few files, and deletes it afterwards, so a case that copies, deletes or changes files touches nothing else. VB6 builds a probe with cases under `dialog` without Unattended Execution, which would write the box to the event log in place of showing it. A file is named as it is in `errors/`; with none named, every file there is used. `--only ` keeps the pages whose path under `docs/` matches. | Command | Effect | |---|---| diff --git a/docs/Reference/Default/VBA/FileSystem/ChDir.md b/docs/Reference/Default/VBA/FileSystem/ChDir.md index 6ccb91652..ac81296b1 100644 --- a/docs/Reference/Default/VBA/FileSystem/ChDir.md +++ b/docs/Reference/Default/VBA/FileSystem/ChDir.md @@ -24,9 +24,6 @@ ChDir "D:\TMP" ' Make "D:\TMP" the current folder. ChDrive "D" ' Make "D" the current drive. ``` -> [!NOTE] BETA 1010 -> **ChDir** raises run-time error -2147467259 (`&H80004005`) for a *path* that does not exist, where VB6 raises 76 (*Path not found*). - + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *path* names no folder that exists, which includes a file, a drive that does not exist, a zero-length string, and a name with a wildcard or a character a name cannot hold | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *path* is **Null** | + +> [!NOTE] BETA 1010 +> When *path* names no folder that exists, which includes a file, a drive that does not exist, a zero-length string, and a name with a wildcard or a character a name cannot hold, VB6 and 64-bit VBA raise error [76 (`&H4C`)](tb:Errors#76), *Path not found*, instead. + + + ### Example This example uses the **ChDir** statement to change the current directory or folder. diff --git a/docs/Reference/Default/VBA/FileSystem/ChDrive.md b/docs/Reference/Default/VBA/FileSystem/ChDrive.md index 4d50f80e1..e302dce80 100644 --- a/docs/Reference/Default/VBA/FileSystem/ChDrive.md +++ b/docs/Reference/Default/VBA/FileSystem/ChDrive.md @@ -16,6 +16,22 @@ Syntax: **ChDrive** *drive* *drive* : *required* A string expression that specifies an existing drive. If *drive* is a zero-length string (""), the current drive doesn't change. If the *drive* argument is a multiple-character string, **ChDrive** uses only the first letter. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *drive* starts with a letter that no drive has
*drive* starts with a digit, a space or a punctuation character | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *drive* is **Null** | + +> [!NOTE] BETA 1010 +> When *drive* starts with a letter that no drive has, VB6 and 64-bit VBA raise error [68 (`&H44`)](tb:Errors#68), *Device unavailable*, instead. + +> [!NOTE] BETA 1010 +> When *drive* starts with a digit, a space or a punctuation character, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*, instead. + + + ### See Also - [ChDir](ChDir), [MkDir](MkDir), and [RmDir](RmDir) statements diff --git a/docs/Reference/Default/VBA/FileSystem/CurDir.md b/docs/Reference/Default/VBA/FileSystem/CurDir.md index 0a6855b73..b1d948842 100644 --- a/docs/Reference/Default/VBA/FileSystem/CurDir.md +++ b/docs/Reference/Default/VBA/FileSystem/CurDir.md @@ -20,6 +20,9 @@ Syntax: **CurDir** [ **(** *drive* **)** ] *drive* : *optional* String expression that specifies an existing drive. If no drive is specified or if *drive* is a zero-length string (`""`), **CurDir** returns the path for the current drive. +> [!NOTE] +> A *drive* that is not a **String**, such as a number or a **Boolean**, is converted to one, as in **ChDrive**, in both **CurDir** and **CurDir$**: `CurDir(5)` looks for drive 5. VB6 and 64-bit VBA raise error 13, *Type mismatch*, for it. + ### Example This example uses the **CurDir** function to return the current path. @@ -58,6 +61,25 @@ MyPath = CurDir$("C") ' Returns "C:\WINDOWS\SYSTEM". MyPath = CurDir$("D") ' Returns "D:\EXCEL". ``` + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *drive* starts with a letter that no drive has
*drive* starts with a digit, a space or a punctuation character | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *drive* is **Null** | + +> [!NOTE] BETA 1010 +> When *drive* starts with a letter that no drive has, VB6 and 64-bit VBA raise error [68 (`&H44`)](tb:Errors#68), *Device unavailable*, instead. + +> [!NOTE] BETA 1010 +> When *drive* starts with a digit, a space or a punctuation character, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*, instead. + +> [!NOTE] BETA 1010 +> When *drive* is **Null**, VB6 and 64-bit VBA raise error [13 (`&HD`)](tb:Errors#13), *Type mismatch*, instead. + + + ### See Also - [ChDir](ChDir), [ChDrive](ChDrive) statements diff --git a/docs/Reference/Default/VBA/FileSystem/Dir.md b/docs/Reference/Default/VBA/FileSystem/Dir.md index 30a513e43..38ef572b8 100644 --- a/docs/Reference/Default/VBA/FileSystem/Dir.md +++ b/docs/Reference/Default/VBA/FileSystem/Dir.md @@ -19,6 +19,9 @@ Syntax: **Dir** [ **(** *pathname* [ **,** *attributes* ] **)** ] *attributes* : *optional* Constant or numeric expression, whose sum specifies file attributes. If omitted, returns files that match *pathname* but have no attributes. +> [!NOTE] +> **Dir** ignores a bit of *attributes* that the table below does not list, so -1 returns every kind of entry, as 23 (**vbReadOnly** + **vbHidden** + **vbSystem** + **vbDirectory**) does. VB6 and 64-bit VBA raise error 5, *Invalid procedure call or argument*, for any value above 63 or below 0. A *pathname* that is not a **String**, such as a number or a **Boolean**, is converted to one, as in **ChDir**: `Dir(5)` looks for a file named 5. VB6 and 64-bit VBA raise error 13, *Type mismatch*, for it. + The *attributes* argument settings are: | Constant | Value | Description | @@ -34,13 +37,35 @@ The *attributes* argument settings are: The first call to **Dir** must specify *pathname*, or an error occurs. When file attributes are also specified, *pathname* must be included. -**Dir** returns the first file name that matches *pathname*. To get any additional file names that match *pathname*, call **Dir** again with no arguments. When no more file names match, **Dir** returns a zero-length string (`""`). After a zero-length string is returned, subsequent calls must specify *pathname*, or an error occurs. +**Dir** returns the first file name that matches *pathname*. To get any additional file names that match *pathname*, call **Dir** again with no arguments. When no more file names match, **Dir** returns a zero-length string (`""`). After a zero-length string is returned, the next call must specify *pathname*. A new *pathname* can be specified without first retrieving all of the file names that match the current *pathname*. However, **Dir** cannot be called recursively. Calling **Dir** with the **vbDirectory** attribute does not continually return subdirectories. > [!TIP] > Because file names are retrieved in case-insensitive order on Windows, consider storing returned file names in an array and sorting the array. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | **Dir** is called without *pathname* after it has returned a zero-length string
*pathname* names a file and ends in a backslash
a name in *pathname* is longer than 255 characters | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *pathname* is **Null**
*attributes* is **Null** | + +> [!NOTE] BETA 1010 +> When **Dir** is called without *pathname* after it has returned a zero-length string, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* names a file and ends in a backslash, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When a name in *pathname* is longer than 255 characters, VB6 and 64-bit VBA raise error [53 (`&H35`)](tb:Errors#53), *File not found*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* is **Null**, VB6 and 64-bit VBA raise error [13 (`&HD`)](tb:Errors#13), *Type mismatch*, instead. + + + ### See Also - [ChDir](ChDir), [ChDrive](ChDrive), [MkDir](MkDir), [RmDir](RmDir) statements diff --git a/docs/Reference/Default/VBA/FileSystem/EOF.md b/docs/Reference/Default/VBA/FileSystem/EOF.md index 557dbf00d..f5692d577 100644 --- a/docs/Reference/Default/VBA/FileSystem/EOF.md +++ b/docs/Reference/Default/VBA/FileSystem/EOF.md @@ -24,8 +24,18 @@ The **EOF** function returns **False** until the end of the file has been reache With files opened for **Binary** access, an attempt to read through the file by using the **Input** function until **EOF** returns **True** generates an error. Use the [LOF](LOF) and **Loc** functions instead of **EOF** when reading binary files with **Input**, or use **Get** when using the **EOF** function. With files opened for **Output**, **EOF** always returns **True**. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *filenumber* is not the number of an open file | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *filenumber* is **Null** | + > [!NOTE] BETA 1010 -> **EOF** raises run-time error -2147467259 (`&H80004005`) for a *filenumber* that is not open, where VB6 raises 52 (*Bad file name or number*). +> When *filenumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/FileAttr.md b/docs/Reference/Default/VBA/FileSystem/FileAttr.md index 73b184a29..861a445c7 100644 --- a/docs/Reference/Default/VBA/FileSystem/FileAttr.md +++ b/docs/Reference/Default/VBA/FileSystem/FileAttr.md @@ -19,9 +19,6 @@ Syntax: **FileAttr(** *filenumber* **,** *returntype* **)** *returntype* : *required* **Integer** indicating the type of information to return. Must be **1** to return the file access mode. -> [!NOTE] BETA 1010 -> **FileAttr** raises run-time error -2147467259 (`&H80004005`) for a *filenumber* that is not open, where VB6 raises 52 (*Bad file name or number*). - ### Return Values The following return values indicate the file access mode: @@ -34,6 +31,22 @@ The following return values indicate the file access mode: | **Append** | 8 | | **Binary** | 32 | + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *filenumber* is not the number of an open file
*returntype* is not 1, after rounding | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *filenumber* or *returntype* is **Null** | + +> [!NOTE] BETA 1010 +> When *filenumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When *returntype* is not 1, after rounding, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*, instead. + + + ### Example This example uses the **FileAttr** function to return the file mode of an open file. diff --git a/docs/Reference/Default/VBA/FileSystem/FileCopy.md b/docs/Reference/Default/VBA/FileSystem/FileCopy.md index 959cd12c8..dc7443b6c 100644 --- a/docs/Reference/Default/VBA/FileSystem/FileCopy.md +++ b/docs/Reference/Default/VBA/FileSystem/FileCopy.md @@ -19,7 +19,39 @@ Syntax: **FileCopy** *source*, *destination* *destination* : *required* String expression that specifies the target file name. The *destination* may include directory or folder, and drive. -**FileCopy** raises run-time error 55 (*File already open*) when *source* is a file that is currently open for **Append**. A file that is open for **Input** is copied without an error, and so is a file that is closed. +A *source* that the program has open is copied when it is open for reading only: **For Input**, or with **Access Read** in any mode, and not locked against reading. + +> [!NOTE] +> VB6 and 64-bit VBA copy an open *source* only when it is open **For Input** and not locked against reading, and raise error 55, *File already open*, for one open with **Access Read** in another mode. + + +### Common Errors + +| Error | When | +|---|---| +| [53 (`&H35`)](tb:Errors#53), *File not found* | *source* does not exist | +| [76 (`&H4C`)](tb:Errors#76), *Path not found* | the folder or drive named in *source* or *destination* does not exist, or *destination* ends in a backslash | +| [55 (`&H37`)](tb:Errors#55), *File already open* | *source* is open with write access or locked against reading, or *destination* is open
*destination* names the same file as *source*
*source* is open **For Input** with **Lock Read** | +| [70 (`&H46`)](tb:Errors#70), *Permission denied* | *source* is a folder, or *destination* is a folder or a read-only or hidden file | +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *source* or *destination* is a zero-length string
*source* or *destination* holds a wildcard or a character a file name cannot hold | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *source* or *destination* is **Null** | + +> [!NOTE] BETA 1010 +> When *destination* names the same file as *source*, VB6 and 64-bit VBA raise error [70 (`&H46`)](tb:Errors#70), *Permission denied*, instead. + +> [!NOTE] BETA 1010 +> When *source* is open **For Input** with **Lock Read**, VB6 and 64-bit VBA raise error [70 (`&H46`)](tb:Errors#70), *Permission denied*, instead. + +> [!NOTE] BETA 1010 +> When *source* is a folder, or *destination* is a folder or a read-only or hidden file, VB6 and 64-bit VBA raise error [75 (`&H4B`)](tb:Errors#75), *Path/File access error*, instead. + +> [!NOTE] BETA 1010 +> When *source* or *destination* is a zero-length string, VB6 and 64-bit VBA raise error [75 (`&H4B`)](tb:Errors#75), *Path/File access error*, instead. + +> [!NOTE] BETA 1010 +> When *source* or *destination* holds a wildcard or a character a file name cannot hold, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/FileDateTime.md b/docs/Reference/Default/VBA/FileSystem/FileDateTime.md index 16483bf03..28b7702f3 100644 --- a/docs/Reference/Default/VBA/FileSystem/FileDateTime.md +++ b/docs/Reference/Default/VBA/FileSystem/FileDateTime.md @@ -16,8 +16,31 @@ Syntax: **FileDateTime(** *pathname* **)** *pathname* : *required* String expression that specifies a file name. The *pathname* may include the directory or folder, and the drive. + +> [!WARNING] BETA 1010 +> Given a *pathname* with a wildcard (`*` or `?`) that matches a file or a folder, **FileDateTime** returns the date and time of the first match, which may be a hidden file or a folder, and raises no error. VB6 and 64-bit VBA raise error 52, *Bad file name or number*. + + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | no file or folder has the name *pathname*, which includes a zero-length string, a folder named with a backslash at its end, and a name with a character a name cannot hold
the folder or drive named in *pathname* does not exist
*pathname* holds a wildcard that matches no file or folder | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *pathname* is **Null** | + +> [!NOTE] BETA 1010 +> When no file or folder has the name *pathname*, which includes a zero-length string, a folder named with a backslash at its end, and a name with a character a name cannot hold, VB6 and 64-bit VBA raise error [53 (`&H35`)](tb:Errors#53), *File not found*, instead. + > [!NOTE] BETA 1010 -> **FileDateTime** raises run-time error -2147467259 (`&H80004005`) for a file that does not exist, where VB6 raises 53 (*File not found*). +> When the folder or drive named in *pathname* does not exist, VB6 and 64-bit VBA raise error [76 (`&H4C`)](tb:Errors#76), *Path not found*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* holds a wildcard that matches no file or folder, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* holds a wildcard that matches a file or folder, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*; twinBASIC raises none. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/FileLen.md b/docs/Reference/Default/VBA/FileSystem/FileLen.md index cfc7a212d..3669cb238 100644 --- a/docs/Reference/Default/VBA/FileSystem/FileLen.md +++ b/docs/Reference/Default/VBA/FileSystem/FileLen.md @@ -21,8 +21,31 @@ If the specified file is open when the **FileLen** function is called, the value > [!NOTE] > Use the [LOF](LOF) function to obtain the length of an open file. + +> [!WARNING] BETA 1010 +> Given a *pathname* with a wildcard (`*` or `?`) that matches a file or a folder, **FileLen** returns the length of the first match, which may be a hidden file, or a folder, whose length is 0, and raises no error. VB6 and 64-bit VBA raise error 52, *Bad file name or number*. + + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | no file or folder has the name *pathname*, which includes a zero-length string, a folder named with a backslash at its end, and a name with a character a name cannot hold
the folder or drive named in *pathname* does not exist
*pathname* holds a wildcard that matches no file or folder | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *pathname* is **Null** | + +> [!NOTE] BETA 1010 +> When no file or folder has the name *pathname*, which includes a zero-length string, a folder named with a backslash at its end, and a name with a character a name cannot hold, VB6 and 64-bit VBA raise error [53 (`&H35`)](tb:Errors#53), *File not found*, instead. + > [!NOTE] BETA 1010 -> **FileLen** raises run-time error -2147467259 (`&H80004005`) for a file that does not exist, where VB6 raises 53 (*File not found*). +> When the folder or drive named in *pathname* does not exist, VB6 and 64-bit VBA raise error [76 (`&H4C`)](tb:Errors#76), *Path not found*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* holds a wildcard that matches no file or folder, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* holds a wildcard that matches a file or folder, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*; twinBASIC raises none. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/FreeFile.md b/docs/Reference/Default/VBA/FileSystem/FreeFile.md index a447f832f..146258015 100644 --- a/docs/Reference/Default/VBA/FileSystem/FreeFile.md +++ b/docs/Reference/Default/VBA/FileSystem/FreeFile.md @@ -18,6 +18,19 @@ Syntax: **FreeFile** [ **(** *rangenumber* **)** ] Use **FreeFile** to supply a file number that is not already in use. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | every file number from 1 to 255 is in use | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *rangenumber* is **Null** | + +> [!NOTE] BETA 1010 +> When every file number from 1 to 255 is in use, VB6 and 64-bit VBA raise error [67 (`&H43`)](tb:Errors#67), *Too many files*, instead. + + + ### Example This example uses the **FreeFile** function to return the next available file number. Five files are opened for output within the loop, and some sample data is written to each. diff --git a/docs/Reference/Default/VBA/FileSystem/GetAttr.md b/docs/Reference/Default/VBA/FileSystem/GetAttr.md index b899624e7..37205b989 100644 --- a/docs/Reference/Default/VBA/FileSystem/GetAttr.md +++ b/docs/Reference/Default/VBA/FileSystem/GetAttr.md @@ -16,9 +16,6 @@ Syntax: **GetAttr(** *pathname* **)** *pathname* : *required* String expression that specifies a file name. The *pathname* may include the directory or folder, and the drive. -> [!NOTE] BETA 1010 -> **GetAttr** raises run-time error -2147467259 (`&H80004005`) for a *pathname* that does not exist. VB6 raises 53 (*File not found*), or 76 (*Path not found*) when the folder does not exist. - ### Return Values The value returned by **GetAttr** is the sum of the following attribute values: @@ -41,6 +38,28 @@ Result = GetAttr(FName) And vbArchive A nonzero value is returned if the Archive attribute is set. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | no file or folder has the name *pathname*, or it is a zero-length string
the folder or drive named in *pathname* does not exist
*pathname* holds a wildcard
*pathname* holds a character a name cannot hold, or names a file with a backslash at its end | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *pathname* is **Null** | + +> [!NOTE] BETA 1010 +> When no file or folder has the name *pathname*, or it is a zero-length string, VB6 and 64-bit VBA raise error [53 (`&H35`)](tb:Errors#53), *File not found*, instead. + +> [!NOTE] BETA 1010 +> When the folder or drive named in *pathname* does not exist, VB6 and 64-bit VBA raise error [76 (`&H4C`)](tb:Errors#76), *Path not found*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* holds a wildcard, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* holds a character a name cannot hold, or names a file with a backslash at its end, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*, instead. + + + ### Example This example uses the **GetAttr** function to determine the attributes of a file and directory or folder. diff --git a/docs/Reference/Default/VBA/FileSystem/Input.md b/docs/Reference/Default/VBA/FileSystem/Input.md index 12b12d219..0b2635202 100644 --- a/docs/Reference/Default/VBA/FileSystem/Input.md +++ b/docs/Reference/Default/VBA/FileSystem/Input.md @@ -30,6 +30,31 @@ For files opened for **Binary** access, an attempt to read through the file usin > [!NOTE] > Use [**InputB**](InputB) for byte data contained within text files. With **InputB**, *Number* specifies the number of bytes to return rather than the number of characters. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *Number* is more characters than are left in a file open for **Input**
the file is open for **Output**, **Append** or **Random**
*Number* is negative, after rounding
*FileNumber* is not the number of an open file
*Number* is 0, after rounding | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *Number* or *FileNumber* is **Null** | + +> [!NOTE] BETA 1010 +> When *Number* is more characters than are left in a file open for **Input**, VB6 and 64-bit VBA raise error [62 (`&H3E`)](tb:Errors#62), *Input past end of file*, instead. + +> [!NOTE] BETA 1010 +> When the file is open for **Output**, **Append** or **Random**, VB6 and 64-bit VBA raise error [54 (`&H36`)](tb:Errors#54), *Bad file mode*, instead. + +> [!NOTE] BETA 1010 +> When *Number* is negative, after rounding, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*, instead. + +> [!NOTE] BETA 1010 +> When *FileNumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When *Number* is 0, after rounding, VB6 and 64-bit VBA raise no error. + + + ### Example This example uses the **Input** function to read one character at a time from a file and print it to the [Debug Console](../../IDE/Debugging/Debug-Console). *TESTFILE* is assumed to be a text file with a few lines of sample data. diff --git a/docs/Reference/Default/VBA/FileSystem/InputB.md b/docs/Reference/Default/VBA/FileSystem/InputB.md index e146a12fc..03eaea785 100644 --- a/docs/Reference/Default/VBA/FileSystem/InputB.md +++ b/docs/Reference/Default/VBA/FileSystem/InputB.md @@ -25,6 +25,28 @@ Syntax: The bytes are packed into the result without any character-set translation; the **String** form simply reinterprets the byte run as a UTF-16 string for storage. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *Number* is more bytes than are left in a file open for **Input**
the file is open for **Output**, **Append** or **Random**
*Number* is negative, after rounding
*FileNumber* is not the number of an open file | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *Number* or *FileNumber* is **Null** | + +> [!NOTE] BETA 1010 +> When *Number* is more bytes than are left in a file open for **Input**, VB6 and 64-bit VBA raise error [62 (`&H3E`)](tb:Errors#62), *Input past end of file*, instead. + +> [!NOTE] BETA 1010 +> When the file is open for **Output**, **Append** or **Random**, VB6 and 64-bit VBA raise error [54 (`&H36`)](tb:Errors#54), *Bad file mode*, instead. + +> [!NOTE] BETA 1010 +> When *Number* is negative, after rounding, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*, instead. + +> [!NOTE] BETA 1010 +> When *FileNumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + + + ### Example ```tb check_build diff --git a/docs/Reference/Default/VBA/FileSystem/Kill.md b/docs/Reference/Default/VBA/FileSystem/Kill.md index fc03b7894..463baff3e 100644 --- a/docs/Reference/Default/VBA/FileSystem/Kill.md +++ b/docs/Reference/Default/VBA/FileSystem/Kill.md @@ -18,18 +18,35 @@ Syntax: **Kill** *pathname* **Kill** supports the use of multiple-character (`*`) and single-character (`?`) wildcards to specify multiple files. -An error occurs when **Kill** is used to delete an open file. - -> [!NOTE] BETA 1010 -> Each of these failures of **Kill** raises run-time error -2147467259 (`&H80004005`), where VB6 raises the numbered error shown: -> -> - 53 (*File not found*) when no file matches *pathname*; -> - 75 (*Path/File access error*) for a read-only file; -> - 55 (*File already open*) for a file that is open. + +> [!WARNING] BETA 1010 +> **Kill** deletes a hidden or a system file, whether *pathname* names it or a wildcard matches it, and raises no error. VB6 and 64-bit VBA never delete such a file: they raise error 53, *File not found*, when *pathname* matches only hidden or system files, and otherwise delete the other files a wildcard matches and leave these. > [!NOTE] > To delete directories, use the [**RmDir**](RmDir) statement. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | no file matches *pathname*, which includes a folder, a folder or drive that does not exist, and a zero-length string
the file, or a file a wildcard matches, is read-only
the file, or a file a wildcard matches, is open | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *pathname* is **Null** | + +> [!NOTE] BETA 1010 +> When no file matches *pathname*, which includes a folder, a folder or drive that does not exist, and a zero-length string, VB6 and 64-bit VBA raise error [53 (`&H35`)](tb:Errors#53), *File not found*, instead. + +> [!NOTE] BETA 1010 +> When the file, or a file a wildcard matches, is read-only, VB6 and 64-bit VBA raise error [75 (`&H4B`)](tb:Errors#75), *Path/File access error*, instead. + +> [!NOTE] BETA 1010 +> When the file, or a file a wildcard matches, is open, VB6 and 64-bit VBA raise error [55 (`&H37`)](tb:Errors#55), *File already open*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* names a hidden or system file, VB6 and 64-bit VBA raise error [53 (`&H35`)](tb:Errors#53), *File not found*; twinBASIC raises none. + + + ### Example This example uses the **Kill** statement to delete a file from a disk. diff --git a/docs/Reference/Default/VBA/FileSystem/LOF.md b/docs/Reference/Default/VBA/FileSystem/LOF.md index 70b312c25..6bb21e135 100644 --- a/docs/Reference/Default/VBA/FileSystem/LOF.md +++ b/docs/Reference/Default/VBA/FileSystem/LOF.md @@ -19,8 +19,18 @@ Syntax: **LOF(** *filenumber* **)** > [!NOTE] > Use the **FileLen** function to obtain the length of a file that is not open. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *filenumber* is not the number of an open file | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *filenumber* is **Null** | + > [!NOTE] BETA 1010 -> **LOF** raises run-time error -2147467259 (`&H80004005`) for a *filenumber* that is not open, where VB6 raises 52 (*Bad file name or number*). +> When *filenumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/Loc.md b/docs/Reference/Default/VBA/FileSystem/Loc.md index 632d1232c..f56831619 100644 --- a/docs/Reference/Default/VBA/FileSystem/Loc.md +++ b/docs/Reference/Default/VBA/FileSystem/Loc.md @@ -26,8 +26,18 @@ The return value depends on the file access mode: | **Sequential** | Current byte position in the file divided by 128. | | **Binary** | Position of the last byte read or written. | + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *filenumber* is not the number of an open file | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *filenumber* is **Null** | + > [!NOTE] BETA 1010 -> **Loc** raises run-time error -2147467259 (`&H80004005`) for a *filenumber* that is not open, where VB6 raises 52 (*Bad file name or number*). +> When *filenumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/MkDir.md b/docs/Reference/Default/VBA/FileSystem/MkDir.md index 6e8e8a2b9..a81e44017 100644 --- a/docs/Reference/Default/VBA/FileSystem/MkDir.md +++ b/docs/Reference/Default/VBA/FileSystem/MkDir.md @@ -16,8 +16,21 @@ Syntax: **MkDir** *path* *path* : A string expression that identifies the directory or folder to be created. The *path* may include the drive. If no drive is specified, **MkDir** creates the new directory or folder on the current drive. + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *path* already exists, as a folder or as a file
the folder or drive that would hold *path* does not exist, or *path* is a zero-length string or a name a folder cannot have | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *path* is **Null** | + > [!NOTE] BETA 1010 -> **MkDir** raises run-time error -2147467259 (`&H80004005`) when it fails. VB6 raises 75 (*Path/File access error*) when *path* already exists, and 76 (*Path not found*) when the folder that would hold it does not exist. +> When *path* already exists, as a folder or as a file, VB6 and 64-bit VBA raise error [75 (`&H4B`)](tb:Errors#75), *Path/File access error*, instead. + +> [!NOTE] BETA 1010 +> When the folder or drive that would hold *path* does not exist, or *path* is a zero-length string or a name a folder cannot have, VB6 and 64-bit VBA raise error [76 (`&H4C`)](tb:Errors#76), *Path not found*, instead. + + ### See Also diff --git a/docs/Reference/Default/VBA/FileSystem/RmDir.md b/docs/Reference/Default/VBA/FileSystem/RmDir.md index 8ddbffa69..37e7674e7 100644 --- a/docs/Reference/Default/VBA/FileSystem/RmDir.md +++ b/docs/Reference/Default/VBA/FileSystem/RmDir.md @@ -16,10 +16,23 @@ Syntax: **RmDir** *path* *path* : A string expression that identifies the directory or folder to be removed. The *path* may include the drive. If no drive is specified, **RmDir** removes the directory or folder on the current drive. -An error occurs when **RmDir** is used on a directory or folder containing files. Use the [**Kill**](Kill) statement to delete all files before attempting to remove a directory or folder. +**RmDir** removes only an empty folder. To remove a folder that holds files, delete them first with the [**Kill**](Kill) statement. + + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | no folder has the name *path*, which includes a file, a zero-length string, and a name with a wildcard or a character a name cannot hold
the folder holds a file or a folder, or it is the current directory | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *path* is **Null** | > [!NOTE] BETA 1010 -> **RmDir** raises run-time error -2147467259 (`&H80004005`) when it fails. VB6 raises 75 (*Path/File access error*) for a folder that holds files, and 76 (*Path not found*) for one that does not exist. +> When no folder has the name *path*, which includes a file, a zero-length string, and a name with a wildcard or a character a name cannot hold, VB6 and 64-bit VBA raise error [76 (`&H4C`)](tb:Errors#76), *Path not found*, instead. + +> [!NOTE] BETA 1010 +> When the folder holds a file or a folder, or it is the current directory, VB6 and 64-bit VBA raise error [75 (`&H4B`)](tb:Errors#75), *Path/File access error*, instead. + + ### See Also diff --git a/docs/Reference/Default/VBA/FileSystem/Seek.md b/docs/Reference/Default/VBA/FileSystem/Seek.md index 2594f86e1..36e99799f 100644 --- a/docs/Reference/Default/VBA/FileSystem/Seek.md +++ b/docs/Reference/Default/VBA/FileSystem/Seek.md @@ -41,10 +41,23 @@ Syntax: **Seek** [ **#** ] *filenumber*, *position* Record numbers specified in [Get](../../Core/Get) and [Put](../../Core/Put) statements override file positioning performed by **Seek**. -Performing a file-write operation after a **Seek** operation beyond the end of a file extends the file. Attempting a **Seek** to a negative or zero position causes an error. +Performing a file-write operation after a **Seek** operation beyond the end of a file extends the file. + + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *filenumber* is not the number of an open file
the statement's *position* is less than 1, after rounding | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *filenumber* or *position* is **Null** | > [!NOTE] BETA 1010 -> The **Seek** function and statement raise run-time error -2147467259 (`&H80004005`) for a *filenumber* that is not open, where VB6 raises 52 (*Bad file name or number*). The statement raises the same error for a *position* of 0, where VB6 raises 63 (*Bad record number*). +> When *filenumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When the statement's *position* is less than 1, after rounding, VB6 and 64-bit VBA raise error [63 (`&H3F`)](tb:Errors#63), *Bad record number*, instead. + + ### Examples diff --git a/docs/Reference/Default/VBA/FileSystem/SetAttr.md b/docs/Reference/Default/VBA/FileSystem/SetAttr.md index 6cb02ad31..52c0aa38f 100644 --- a/docs/Reference/Default/VBA/FileSystem/SetAttr.md +++ b/docs/Reference/Default/VBA/FileSystem/SetAttr.md @@ -31,13 +31,35 @@ The *attributes* settings are: | **vbSystem** | 4 | System file. | | **vbArchive** | 32 | File has changed since last backup. | +**SetAttr** passes *attributes* to Windows as it is, so it sets any attribute Windows lets a program set, such as 256 (temporary) or 8192 (not indexed), and raises an error where Windows refuses. A bit that Windows ignores, such as **vbDirectory** (16) on a file, is left out. + +> [!NOTE] +> VB6 and 64-bit VBA raise error 5, *Invalid procedure call or argument*, for *attributes* that are not a sum of the values in the table, and for **vbDirectory** on a folder. + **SetAttr** sets the attributes of a file that is open, whatever mode it is open in, without an error. + > [!WARNING] BETA 1010 -> This differs from VB6, which raises run-time error 55 (*File already open*) for a file open for **Output**, **Append**, **Binary** or **Random**, and leaves its attributes unchanged. VB6 sets them only for a file open for **Input**. So twinBASIC can make a file read-only while the program still has it open for writing. +> This differs from VB6 and 64-bit VBA, which raise run-time error 55 (*File already open*) for a file open for **Output**, **Append**, **Binary** or **Random**, and leave its attributes unchanged. They set them only for a file open for **Input**. So twinBASIC can make a file read-only while the program still has it open for writing. + + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | no file or folder has the name *pathname*, which includes one in a folder or drive that does not exist, a zero-length string, and a name with a character a name cannot hold
*pathname* holds a wildcard | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *pathname* or *attributes* is **Null** | > [!NOTE] BETA 1010 -> **SetAttr** raises run-time error -2147467259 (`&H80004005`) for a file that does not exist, where VB6 raises 53 (*File not found*). +> When no file or folder has the name *pathname*, which includes one in a folder or drive that does not exist, a zero-length string, and a name with a character a name cannot hold, VB6 and 64-bit VBA raise error [53 (`&H35`)](tb:Errors#53), *File not found*, instead. + +> [!NOTE] BETA 1010 +> When *pathname* holds a wildcard, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When the file is open for **Output**, **Append**, **Binary** or **Random**, VB6 and 64-bit VBA raise error [55 (`&H37`)](tb:Errors#55), *File already open*; twinBASIC raises none. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/Width.md b/docs/Reference/Default/VBA/FileSystem/Width.md index 013cfaa4d..eb79e5bdd 100644 --- a/docs/Reference/Default/VBA/FileSystem/Width.md +++ b/docs/Reference/Default/VBA/FileSystem/Width.md @@ -18,7 +18,30 @@ Syntax: **Width #** *FileNumber* **,** *Width* : *required* The file number used to open the file. *Width* -: *required* A numeric expression in the range 0--255, inclusive, indicating how many characters appear on a line before a new line is started. If *Width* equals `0`, there is no limit to the length of a line. The default is `0`. +: *required* An **Integer** in the range 0--32,767, inclusive, indicating how many characters appear on a line before a new line is started. If *Width* equals `0`, there is no limit to the length of a line. The default is `0`. + +> [!NOTE] +> VB6 and 64-bit VBA take a *Width* from 0 to 255 only, and raise error 5, *Invalid procedure call or argument*, for one above 255. + + +> [!WARNING] BETA 1010 +> A negative *Width* raises no error, and **Print #** then starts a new line before each item after the first. VB6 and 64-bit VBA raise error 5, *Invalid procedure call or argument*. + + +### Common Errors + +| Error | When | +|---|---| +| [-2147467259 (`&H80004005`)](tb:Errors#-2147467259), *Unspecified error* | *FileNumber* is not the number of an open file | +| [94 (`&H5E`)](tb:Errors#94), *Invalid use of Null* | *Width* is **Null** | + +> [!NOTE] BETA 1010 +> When *FileNumber* is not the number of an open file, VB6 and 64-bit VBA raise error [52 (`&H34`)](tb:Errors#52), *Bad file name or number*, instead. + +> [!NOTE] BETA 1010 +> When *Width* is negative, after rounding, VB6 and 64-bit VBA raise error [5 (`&H5`)](tb:Errors#5), *Invalid procedure call or argument*; twinBASIC raises none. + + ### Example diff --git a/docs/Reference/Default/VBA/FileSystem/index.md b/docs/Reference/Default/VBA/FileSystem/index.md index 625e028d4..447e3dbae 100644 --- a/docs/Reference/Default/VBA/FileSystem/index.md +++ b/docs/Reference/Default/VBA/FileSystem/index.md @@ -35,7 +35,7 @@ Loop ## Copying and deleting -[**FileCopy**](FileCopy) copies one file to another, and [**Kill**](Kill) deletes files matching a wildcard pattern. Both operate by pathname. **Kill** raises a run-time error when asked to delete a file that is open, and **FileCopy** raises one for a file that is open for **Append**. +[**FileCopy**](FileCopy) copies one file to another, and [**Kill**](Kill) deletes files matching a wildcard pattern. Both operate by pathname. **Kill** raises a run-time error when asked to delete a file that is open, and **FileCopy** raises one for a file that is open with write access. ```tb check_build FileCopy "C:\Data\report.xlsx", "C:\Backup\report.xlsx" diff --git a/docs/Reference/Run-time-Errors.md b/docs/Reference/Run-time-Errors.md index 40b868843..b531660f1 100644 --- a/docs/Reference/Run-time-Errors.md +++ b/docs/Reference/Run-time-Errors.md @@ -63,9 +63,9 @@ The messages are those of twinBASIC 32-bit and VB6, which agree for every number | **49**{: #49 } (`&H31`) | *Bad DLL calling convention* | --- | | **51**{: #51 } (`&H33`) | *Internal error* | --- | | **52**{: #52 } (`&H34`) | *Bad file name or number* | --- | -| **53**{: #53 } (`&H35`) | *File not found* | --- | +| **53**{: #53 } (`&H35`) | *File not found* | [1 page](#listed-53) | | **54**{: #54 } (`&H36`) | *Bad file mode* | --- | -| **55**{: #55 } (`&H37`) | *File already open* | --- | +| **55**{: #55 } (`&H37`) | *File already open* | [1 page](#listed-55) | | **57**{: #57 } (`&H39`) | *Device I/O error* | --- | | **58**{: #58 } (`&H3A`) | *File already exists* | --- | | **59**{: #59 } (`&H3B`) | *Bad record length* | --- | @@ -74,15 +74,15 @@ The messages are those of twinBASIC 32-bit and VB6, which agree for every number | **63**{: #63 } (`&H3F`) | *Bad record number* | --- | | **67**{: #67 } (`&H43`) | *Too many files* | --- | | **68**{: #68 } (`&H44`) | *Device unavailable* | --- | -| **70**{: #70 } (`&H46`) | *Permission denied* | --- | +| **70**{: #70 } (`&H46`) | *Permission denied* | [1 page](#listed-70) | | **71**{: #71 } (`&H47`) | *Disk not ready* | --- | | **74**{: #74 } (`&H4A`) | *Can't rename with different drive* | --- | | **75**{: #75 } (`&H4B`) | *Path/File access error* | --- | -| **76**{: #76 } (`&H4C`) | *Path not found* | --- | +| **76**{: #76 } (`&H4C`) | *Path not found* | [1 page](#listed-76) | | **91**{: #91 } (`&H5B`) | *Object variable or With block variable not set* | [2 pages](#listed-91) | | **92**{: #92 } (`&H5C`) | *For loop not initialized* | --- | | **93**{: #93 } (`&H5D`) | *Invalid pattern string* | --- | -| **94**{: #94 } (`&H5E`) | *Invalid use of Null* | [100 pages](#listed-94) | +| **94**{: #94 } (`&H5E`) | *Invalid use of Null* | [121 pages](#listed-94) | | **96**{: #96 } (`&H60`) | *Unable to sink events of object because the object is already firing events to the maximum number of event receivers that it supports* | --- | | **97**{: #97 } (`&H61`) | *Can not call friend function on object which is not an instance of defining class* | --- | | **98**{: #98 } (`&H62`) | *A property or method call cannot include a reference to a private object, either as an argument or as a return value* | --- | @@ -131,7 +131,7 @@ The messages are those of twinBASIC 32-bit and VB6, which agree for every number | **744**{: #744 } (`&H2E8`) | *Search text not found* | --- | | **746**{: #746 } (`&H2EA`) | *Replacements too long* | --- | | **-2147467262**{: #-2147467262 } (`&H80004002`) | *No such interface supported*; **Error** gives *Application-defined or object-defined error* | [1 page](#listed--2147467262) | -| **-2147467259**{: #-2147467259 } (`&H80004005`) | *Unspecified error*; **Error** gives *Application-defined or object-defined error* | [20 pages](#listed--2147467259) | +| **-2147467259**{: #-2147467259 } (`&H80004005`) | *Unspecified error*; **Error** gives *Application-defined or object-defined error* | [41 pages](#listed--2147467259) | | **-2147352567**{: #-2147352567 } (`&H80020009`) | *Exception occurred.*; **Error** gives *Application-defined or object-defined error* | [2 pages](#listed--2147352567) | | **-2147352562**{: #-2147352562 } (`&H8002000E`) | *Invalid number of parameters.*; **Error** gives *Application-defined or object-defined error* | [2 pages](#listed--2147352562) | | **-2147352559**{: #-2147352559 } (`&H80020011`) | *Does not support a collection.*; **Error** gives *Application-defined or object-defined error* | [1 page](#listed--2147352559) | @@ -153,15 +153,23 @@ The messages are those of twinBASIC 32-bit and VB6, which agree for every number **13**{: #listed-13 } (`&HD`): [Bin](../tB/Modules/Conversion/Bin), [CBool](../tB/Modules/Conversion/CBool), [CByte](../tB/Modules/Conversion/CByte), [CCur](../tB/Modules/Conversion/CCur), [CDate](../tB/Modules/Conversion/CDate), [CDbl](../tB/Modules/Conversion/CDbl), [CDec](../tB/Modules/Conversion/CDec), [CInt](../tB/Modules/Conversion/CInt), [CLng](../tB/Modules/Conversion/CLng), [CLngLng](../tB/Modules/Conversion/CLngLng), [CLngPtr](../tB/Modules/Conversion/CLngPtr), [CSng](../tB/Modules/Conversion/CSng), [CType](../tB/Modules/Conversion/CType), [CVDate](../tB/Modules/Conversion/CVDate), [Date](../tB/Modules/DateTime/Date), [DateAdd](../tB/Modules/DateTime/DateAdd), [DateDiff](../tB/Modules/DateTime/DateDiff), [DatePart](../tB/Modules/DateTime/DatePart), [DateValue](../tB/Modules/DateTime/DateValue), [Day](../tB/Modules/DateTime/Day), [Filter](../tB/Modules/Strings/Filter), [Hex](../tB/Modules/Conversion/Hex), [Hour](../tB/Modules/DateTime/Hour), [If](../tB/Modules/Interaction/If), [IIf](../tB/Modules/Interaction/IIf), [Join](../tB/Modules/Strings/Join), [LBound](../tB/Modules/Information/LBound), [Minute](../tB/Modules/DateTime/Minute), [Month](../tB/Modules/DateTime/Month), [Oct](../tB/Modules/Conversion/Oct), [ReDim](../tB/Core/ReDim), [Second](../tB/Modules/DateTime/Second), [Switch](../tB/Modules/Interaction/Switch), [Time](../tB/Modules/DateTime/Time), [TimeValue](../tB/Modules/DateTime/TimeValue), [UBound](../tB/Modules/Information/UBound), [Val](../tB/Modules/Conversion/Val), [Weekday](../tB/Modules/DateTime/Weekday), [Year](../tB/Modules/DateTime/Year) +**53**{: #listed-53 } (`&H35`): [FileCopy](../tB/Modules/FileSystem/FileCopy) + +**55**{: #listed-55 } (`&H37`): [FileCopy](../tB/Modules/FileSystem/FileCopy) + +**70**{: #listed-70 } (`&H46`): [FileCopy](../tB/Modules/FileSystem/FileCopy) + +**76**{: #listed-76 } (`&H4C`): [FileCopy](../tB/Modules/FileSystem/FileCopy) + **91**{: #listed-91 } (`&H5B`): [RaiseEventByName](../tB/Modules/Interaction/RaiseEventByName), [RaiseEventByName2](../tB/Modules/Interaction/RaiseEventByName2) -**94**{: #listed-94 } (`&H5E`): [AppActivate](../tB/Modules/Interaction/AppActivate), [Asc](../tB/Modules/Strings/Asc), [Atn](../tB/Modules/Math/Atn), [Bin](../tB/Modules/Conversion/Bin), [Calendar](../tB/Modules/DateTime/Calendar), [CallByDispId](../tB/Modules/Interaction/CallByDispId), [CallByName](../tB/Modules/Interaction/CallByName), [CBool](../tB/Modules/Conversion/CBool), [CByte](../tB/Modules/Conversion/CByte), [CCur](../tB/Modules/Conversion/CCur), [CDate](../tB/Modules/Conversion/CDate), [CDbl](../tB/Modules/Conversion/CDbl), [CDec](../tB/Modules/Conversion/CDec), [Choose](../tB/Modules/Interaction/Choose), [Chr](../tB/Modules/Strings/Chr), [CInt](../tB/Modules/Conversion/CInt), [CLng](../tB/Modules/Conversion/CLng), [CLngLng](../tB/Modules/Conversion/CLngLng), [CLngPtr](../tB/Modules/Conversion/CLngPtr), [Cos](../tB/Modules/Math/Cos), [CreateObject](../tB/Modules/Interaction/CreateObject), [CSng](../tB/Modules/Conversion/CSng), [CStr](../tB/Modules/Conversion/CStr), [CType](../tB/Modules/Conversion/CType), [CVErr](../tB/Modules/Conversion/CVErr), [Date](../tB/Modules/DateTime/Date), [DateAdd](../tB/Modules/DateTime/DateAdd), [DateDiff](../tB/Modules/DateTime/DateDiff), [DatePart](../tB/Modules/DateTime/DatePart), [DateSerial](../tB/Modules/DateTime/DateSerial), [DateValue](../tB/Modules/DateTime/DateValue), [DeleteSetting](../tB/Modules/Interaction/DeleteSetting), [Environ](../tB/Modules/Interaction/Environ), [Error function](../tB/Modules/Conversion/Error), [Exp](../tB/Modules/Math/Exp), [Filter](../tB/Modules/Strings/Filter), [Format](../tB/Modules/Strings/Format), [FormatCurrency](../tB/Modules/Strings/FormatCurrency), [FormatDateTime](../tB/Modules/Strings/FormatDateTime), [FormatNumber](../tB/Modules/Strings/FormatNumber), [FormatPercent](../tB/Modules/Strings/FormatPercent), [GetAllSettings](../tB/Modules/Interaction/GetAllSettings), [GetObject](../tB/Modules/Interaction/GetObject), [GetSetting](../tB/Modules/Interaction/GetSetting), [Hex](../tB/Modules/Conversion/Hex), [InputBox](../tB/Modules/Interaction/InputBox), [InStr](../tB/Modules/Strings/InStr), [InStrRev](../tB/Modules/Strings/InStrRev), [Join](../tB/Modules/Strings/Join), [LBound](../tB/Modules/Information/LBound), [LCase](../tB/Modules/Strings/LCase), [Left](../tB/Modules/Strings/Left), [Log](../tB/Modules/Math/Log), [LTrim](../tB/Modules/Strings/LTrim), [MacID](../tB/Modules/Conversion/MacID), [Mid](../tB/Modules/Strings/Mid), [MonthName](../tB/Modules/Strings/MonthName), [MsgBox](../tB/Modules/Interaction/MsgBox), [Oct](../tB/Modules/Conversion/Oct), [QBColor](../tB/Modules/Information/QBColor), [Randomize](../tB/Modules/Math/Randomize), [Replace](../tB/Modules/Strings/Replace), [RGB](../tB/Modules/Information/RGB), [RGB_B](../tB/Modules/Information/RGB_B), [RGB_G](../tB/Modules/Information/RGB_G), [RGB_R](../tB/Modules/Information/RGB_R), [RGBA](../tB/Modules/Information/RGBA), [RGBA_A](../tB/Modules/Information/RGBA_A), [Right](../tB/Modules/Strings/Right), [Rnd](../tB/Modules/Math/Rnd), [Round](../tB/Modules/Math/Round), [RTrim](../tB/Modules/Strings/RTrim), [SaveSetting](../tB/Modules/Interaction/SaveSetting), [SendKeys](../tB/Modules/Interaction/SendKeys), [Sgn](../tB/Modules/Math/Sgn), [Shell](../tB/Modules/Interaction/Shell), [ShiftRotateLeft](../tB/Modules/Math/ShiftRotateLeft), [ShiftRotateRight](../tB/Modules/Math/ShiftRotateRight), [ShiftUnsignedRight](../tB/Modules/Math/ShiftUnsignedRight), [Sin](../tB/Modules/Math/Sin), [Space](../tB/Modules/Strings/Space), [Split](../tB/Modules/Strings/Split), [Sqr](../tB/Modules/Math/Sqr), [Str](../tB/Modules/Conversion/Str), [StrComp](../tB/Modules/Strings/StrComp), [StrConv](../tB/Modules/Strings/StrConv), [String](../tB/Modules/Strings/String), [StrReverse](../tB/Modules/Strings/StrReverse), [Tan](../tB/Modules/Math/Tan), [Time](../tB/Modules/DateTime/Time), [TimeSerial](../tB/Modules/DateTime/TimeSerial), [TimeValue](../tB/Modules/DateTime/TimeValue), [TranslateColor](../tB/Modules/Information/TranslateColor), [Trim](../tB/Modules/Strings/Trim), [UBound](../tB/Modules/Information/UBound), [UCase](../tB/Modules/Strings/UCase), [Val](../tB/Modules/Conversion/Val), [ValDec](../tB/Modules/Conversion/ValDec), [Weekday](../tB/Modules/DateTime/Weekday), [WeekdayName](../tB/Modules/Strings/WeekdayName) +**94**{: #listed-94 } (`&H5E`): [AppActivate](../tB/Modules/Interaction/AppActivate), [Asc](../tB/Modules/Strings/Asc), [Atn](../tB/Modules/Math/Atn), [Bin](../tB/Modules/Conversion/Bin), [Calendar](../tB/Modules/DateTime/Calendar), [CallByDispId](../tB/Modules/Interaction/CallByDispId), [CallByName](../tB/Modules/Interaction/CallByName), [CBool](../tB/Modules/Conversion/CBool), [CByte](../tB/Modules/Conversion/CByte), [CCur](../tB/Modules/Conversion/CCur), [CDate](../tB/Modules/Conversion/CDate), [CDbl](../tB/Modules/Conversion/CDbl), [CDec](../tB/Modules/Conversion/CDec), [ChDir](../tB/Modules/FileSystem/ChDir), [ChDrive](../tB/Modules/FileSystem/ChDrive), [Choose](../tB/Modules/Interaction/Choose), [Chr](../tB/Modules/Strings/Chr), [CInt](../tB/Modules/Conversion/CInt), [CLng](../tB/Modules/Conversion/CLng), [CLngLng](../tB/Modules/Conversion/CLngLng), [CLngPtr](../tB/Modules/Conversion/CLngPtr), [Cos](../tB/Modules/Math/Cos), [CreateObject](../tB/Modules/Interaction/CreateObject), [CSng](../tB/Modules/Conversion/CSng), [CStr](../tB/Modules/Conversion/CStr), [CType](../tB/Modules/Conversion/CType), [CurDir](../tB/Modules/FileSystem/CurDir), [CVErr](../tB/Modules/Conversion/CVErr), [Date](../tB/Modules/DateTime/Date), [DateAdd](../tB/Modules/DateTime/DateAdd), [DateDiff](../tB/Modules/DateTime/DateDiff), [DatePart](../tB/Modules/DateTime/DatePart), [DateSerial](../tB/Modules/DateTime/DateSerial), [DateValue](../tB/Modules/DateTime/DateValue), [DeleteSetting](../tB/Modules/Interaction/DeleteSetting), [Dir](../tB/Modules/FileSystem/Dir), [Environ](../tB/Modules/Interaction/Environ), [EOF](../tB/Modules/FileSystem/EOF), [Error function](../tB/Modules/Conversion/Error), [Exp](../tB/Modules/Math/Exp), [FileAttr](../tB/Modules/FileSystem/FileAttr), [FileCopy](../tB/Modules/FileSystem/FileCopy), [FileDateTime](../tB/Modules/FileSystem/FileDateTime), [FileLen](../tB/Modules/FileSystem/FileLen), [Filter](../tB/Modules/Strings/Filter), [Format](../tB/Modules/Strings/Format), [FormatCurrency](../tB/Modules/Strings/FormatCurrency), [FormatDateTime](../tB/Modules/Strings/FormatDateTime), [FormatNumber](../tB/Modules/Strings/FormatNumber), [FormatPercent](../tB/Modules/Strings/FormatPercent), [FreeFile](../tB/Modules/FileSystem/FreeFile), [GetAllSettings](../tB/Modules/Interaction/GetAllSettings), [GetAttr](../tB/Modules/FileSystem/GetAttr), [GetObject](../tB/Modules/Interaction/GetObject), [GetSetting](../tB/Modules/Interaction/GetSetting), [Hex](../tB/Modules/Conversion/Hex), [Input, Input$](../tB/Modules/FileSystem/Input), [InputB, InputB$](../tB/Modules/FileSystem/InputB), [InputBox](../tB/Modules/Interaction/InputBox), [InStr](../tB/Modules/Strings/InStr), [InStrRev](../tB/Modules/Strings/InStrRev), [Join](../tB/Modules/Strings/Join), [Kill](../tB/Modules/FileSystem/Kill), [LBound](../tB/Modules/Information/LBound), [LCase](../tB/Modules/Strings/LCase), [Left](../tB/Modules/Strings/Left), [Loc](../tB/Modules/FileSystem/Loc), [LOF](../tB/Modules/FileSystem/LOF), [Log](../tB/Modules/Math/Log), [LTrim](../tB/Modules/Strings/LTrim), [MacID](../tB/Modules/Conversion/MacID), [Mid](../tB/Modules/Strings/Mid), [MkDir](../tB/Modules/FileSystem/MkDir), [MonthName](../tB/Modules/Strings/MonthName), [MsgBox](../tB/Modules/Interaction/MsgBox), [Oct](../tB/Modules/Conversion/Oct), [QBColor](../tB/Modules/Information/QBColor), [Randomize](../tB/Modules/Math/Randomize), [Replace](../tB/Modules/Strings/Replace), [RGB](../tB/Modules/Information/RGB), [RGB_B](../tB/Modules/Information/RGB_B), [RGB_G](../tB/Modules/Information/RGB_G), [RGB_R](../tB/Modules/Information/RGB_R), [RGBA](../tB/Modules/Information/RGBA), [RGBA_A](../tB/Modules/Information/RGBA_A), [Right](../tB/Modules/Strings/Right), [RmDir](../tB/Modules/FileSystem/RmDir), [Rnd](../tB/Modules/Math/Rnd), [Round](../tB/Modules/Math/Round), [RTrim](../tB/Modules/Strings/RTrim), [SaveSetting](../tB/Modules/Interaction/SaveSetting), [Seek](../tB/Modules/FileSystem/Seek), [SendKeys](../tB/Modules/Interaction/SendKeys), [SetAttr](../tB/Modules/FileSystem/SetAttr), [Sgn](../tB/Modules/Math/Sgn), [Shell](../tB/Modules/Interaction/Shell), [ShiftRotateLeft](../tB/Modules/Math/ShiftRotateLeft), [ShiftRotateRight](../tB/Modules/Math/ShiftRotateRight), [ShiftUnsignedRight](../tB/Modules/Math/ShiftUnsignedRight), [Sin](../tB/Modules/Math/Sin), [Space](../tB/Modules/Strings/Space), [Split](../tB/Modules/Strings/Split), [Sqr](../tB/Modules/Math/Sqr), [Str](../tB/Modules/Conversion/Str), [StrComp](../tB/Modules/Strings/StrComp), [StrConv](../tB/Modules/Strings/StrConv), [String](../tB/Modules/Strings/String), [StrReverse](../tB/Modules/Strings/StrReverse), [Tan](../tB/Modules/Math/Tan), [Time](../tB/Modules/DateTime/Time), [TimeSerial](../tB/Modules/DateTime/TimeSerial), [TimeValue](../tB/Modules/DateTime/TimeValue), [TranslateColor](../tB/Modules/Information/TranslateColor), [Trim](../tB/Modules/Strings/Trim), [UBound](../tB/Modules/Information/UBound), [UCase](../tB/Modules/Strings/UCase), [Val](../tB/Modules/Conversion/Val), [ValDec](../tB/Modules/Conversion/ValDec), [Weekday](../tB/Modules/DateTime/Weekday), [WeekdayName](../tB/Modules/Strings/WeekdayName), [Width](../tB/Modules/FileSystem/Width) **438**{: #listed-438 } (`&H1B6`): [CallByDispId](../tB/Modules/Interaction/CallByDispId), [CallByName](../tB/Modules/Interaction/CallByName) **-2147467262**{: #listed--2147467262 } (`&H80004002`): [GetObject](../tB/Modules/Interaction/GetObject) -**-2147467259**{: #listed--2147467259 } (`&H80004005`): [AppActivate](../tB/Modules/Interaction/AppActivate), [Calendar](../tB/Modules/DateTime/Calendar), [CallByDispId](../tB/Modules/Interaction/CallByDispId), [CallByName](../tB/Modules/Interaction/CallByName), [Date](../tB/Modules/DateTime/Date), [DeleteSetting](../tB/Modules/Interaction/DeleteSetting), [Environ](../tB/Modules/Interaction/Environ), [GetAllSettings](../tB/Modules/Interaction/GetAllSettings), [GetObject](../tB/Modules/Interaction/GetObject), [GetSetting](../tB/Modules/Interaction/GetSetting), [InputBox](../tB/Modules/Interaction/InputBox), [LBound](../tB/Modules/Information/LBound), [MsgBox](../tB/Modules/Interaction/MsgBox), [Partition](../tB/Modules/Interaction/Partition), [ReDim](../tB/Core/ReDim), [SaveSetting](../tB/Modules/Interaction/SaveSetting), [Shell](../tB/Modules/Interaction/Shell), [Switch](../tB/Modules/Interaction/Switch), [Time](../tB/Modules/DateTime/Time), [UBound](../tB/Modules/Information/UBound) +**-2147467259**{: #listed--2147467259 } (`&H80004005`): [AppActivate](../tB/Modules/Interaction/AppActivate), [Calendar](../tB/Modules/DateTime/Calendar), [CallByDispId](../tB/Modules/Interaction/CallByDispId), [CallByName](../tB/Modules/Interaction/CallByName), [ChDir](../tB/Modules/FileSystem/ChDir), [ChDrive](../tB/Modules/FileSystem/ChDrive), [CurDir](../tB/Modules/FileSystem/CurDir), [Date](../tB/Modules/DateTime/Date), [DeleteSetting](../tB/Modules/Interaction/DeleteSetting), [Dir](../tB/Modules/FileSystem/Dir), [Environ](../tB/Modules/Interaction/Environ), [EOF](../tB/Modules/FileSystem/EOF), [FileAttr](../tB/Modules/FileSystem/FileAttr), [FileCopy](../tB/Modules/FileSystem/FileCopy), [FileDateTime](../tB/Modules/FileSystem/FileDateTime), [FileLen](../tB/Modules/FileSystem/FileLen), [FreeFile](../tB/Modules/FileSystem/FreeFile), [GetAllSettings](../tB/Modules/Interaction/GetAllSettings), [GetAttr](../tB/Modules/FileSystem/GetAttr), [GetObject](../tB/Modules/Interaction/GetObject), [GetSetting](../tB/Modules/Interaction/GetSetting), [Input, Input$](../tB/Modules/FileSystem/Input), [InputB, InputB$](../tB/Modules/FileSystem/InputB), [InputBox](../tB/Modules/Interaction/InputBox), [Kill](../tB/Modules/FileSystem/Kill), [LBound](../tB/Modules/Information/LBound), [Loc](../tB/Modules/FileSystem/Loc), [LOF](../tB/Modules/FileSystem/LOF), [MkDir](../tB/Modules/FileSystem/MkDir), [MsgBox](../tB/Modules/Interaction/MsgBox), [Partition](../tB/Modules/Interaction/Partition), [ReDim](../tB/Core/ReDim), [RmDir](../tB/Modules/FileSystem/RmDir), [SaveSetting](../tB/Modules/Interaction/SaveSetting), [Seek](../tB/Modules/FileSystem/Seek), [SetAttr](../tB/Modules/FileSystem/SetAttr), [Shell](../tB/Modules/Interaction/Shell), [Switch](../tB/Modules/Interaction/Switch), [Time](../tB/Modules/DateTime/Time), [UBound](../tB/Modules/Information/UBound), [Width](../tB/Modules/FileSystem/Width) **-2147352567**{: #listed--2147352567 } (`&H80020009`): [CallByName](../tB/Modules/Interaction/CallByName), [SendKeys](../tB/Modules/Interaction/SendKeys) diff --git a/errors/VBA.FileSystem.yml b/errors/VBA.FileSystem.yml new file mode 100644 index 000000000..8148aaa42 --- /dev/null +++ b/errors/VBA.FileSystem.yml @@ -0,0 +1,894 @@ +# The VBA FileSystem module. Format: WIP.Errors.md. Every case runs under the files harness, in a +# folder of its own that is the current directory: a.txt (10 bytes), empty.txt, ro.txt +# (read-only), hid.txt (hidden), the empty folder sub, and full, which holds f.txt. +beta: 1010 +pages: + Reference/Default/VBA/FileSystem/ChDir.md: + harness: files + rows: + - error: -2147467259 + when: "*path* names no folder that exists, which includes a file, a drive that does not exist, a zero-length string, and a name with a wildcard or a character a name cannot hold" + vb6: 76 + bug: file-errors-unspecified + cases: + - { run: 'ChDir "nosuch"' } + - { run: 'ChDir "nosub\deeper"' } + - { run: 'ChDir ""' } + - { run: 'ChDir " "' } + - { run: 'ChDir "a.txt"' } + - { run: 'ChDir files_NoDrive & ":\"' } + - { run: 'ChDir files_NoDrive & ":\x"' } + - { run: 'ChDir String(300, "a")' } + - { run: 'ChDir "*"' } + - { run: 'ChDir "su?"' } + - { run: 'ChDir "a files_Dir' } + - { run: 'ChDir files_Dir & "\full": files_Expect CurDir$ = files_Dir & "\full"' } + Reference/Default/VBA/FileSystem/ChDrive.md: + harness: files + rows: + - error: -2147467259 + when: "*drive* starts with a letter that no drive has" + vb6: 68 + bug: file-errors-unspecified + cases: + - { run: 'ChDrive files_NoDrive' } + - { run: 'ChDrive files_NoDrive & ":\"' } + - error: -2147467259 + when: "*drive* starts with a digit, a space or a punctuation character" + vb6: 5 + bug: file-errors-unspecified + cases: + - { run: 'ChDrive "1"' } + - { run: 'ChDrive " "' } + - { run: 'ChDrive "?"' } + - { run: 'ChDrive "\"' } + - { run: 'ChDrive "@"' } + - { run: 'ChDrive "["' } + - { run: 'ChDrive 5' } + - error: 94 + when: "*drive* is **Null**" + cases: + - { run: 'ChDrive Null' } + quiet: + - { run: 'ChDrive ""' } + - { run: 'ChDrive Empty' } + - { run: 'ChDrive Left$(files_Dir, 1)' } + - { run: 'ChDrive LCase$(Left$(files_Dir, 1))' } + - { run: 'ChDrive Left$(files_Dir, 1) & "xyz"' } + - { run: 'ChDrive Left$(files_Dir, 3)' } + Reference/Default/VBA/FileSystem/CurDir.md: + harness: files + rows: + - error: -2147467259 + when: "*drive* starts with a letter that no drive has" + vb6: 68 + bug: file-errors-unspecified + cases: + - CurDir(files_NoDrive) + - CurDir$(files_NoDrive) + - error: -2147467259 + when: "*drive* starts with a digit, a space or a punctuation character" + vb6: 5 + bug: file-errors-unspecified + cases: + - CurDir("1") + - CurDir(" ") + - CurDir("?") + - CurDir("@") + - CurDir$("1") + - { expr: CurDir(5), only: tb } + - error: 94 + when: "*drive* is **Null**" + vb6: 13 + bug: filesystem-argument-checks + cases: + - CurDir(Null) + - CurDir$(Null) + quiet: + - CurDir + - CurDir("") + - CurDir$ + - CurDir$("") + - CurDir(Left$(files_Dir, 1)) + - CurDir(LCase$(Left$(files_Dir, 1)) & "xyz") + - { decl: Dim S As String, setup: 'S = Left$(files_Dir, 1)', expr: CurDir(S) } + - { decl: Dim V As Variant, setup: 'V = Left$(files_Dir, 1)', expr: CurDir(V) } + - { run: 'files_Expect CurDir = files_Dir' } + Reference/Default/VBA/FileSystem/Dir.md: + harness: files + rows: + - error: -2147467259 + when: "**Dir** is called without *pathname* after it has returned a zero-length string" + vb6: 5 + bug: file-errors-unspecified + cases: + - { setup: 'Result = Dir("nosuch.txt")', expr: Dir() } + - { setup: 'Result = Dir("nosuch.txt")', expr: Dir } + - { setup: 'Result = Dir("a.txt")', run: 'Result = Dir(): Result = Dir()' } + - error: -2147467259 + when: "*pathname* names a file and ends in a backslash" + vb6: 52 + bug: file-errors-unspecified + cases: + - Dir("a.txt\") + - error: -2147467259 + when: "a name in *pathname* is longer than 255 characters" + vb6: 53 + bug: file-errors-unspecified + cases: + - Dir(String(256, "a")) + - Dir(String(300, "a")) + - error: 94 + when: "*pathname* is **Null**" + vb6: 13 + bug: filesystem-argument-checks + cases: + - Dir(Null) + - 'Dir(Null, 0)' + - error: 94 + when: "*attributes* is **Null**" + cases: + - 'Dir("a.txt", Null)' + quiet: + - { run: 'files_Expect Dir("a.txt") = "a.txt"' } + - { run: 'files_Expect Dir("nosuch.txt") = ""' } + - { setup: 'Result = Dir("a.txt")', run: 'files_Expect Dir() = ""' } + - Dir("") + - 'Dir("", 8)' + - 'Dir("*.txt", 8)' + - 'Dir("*", 16)' + - 'Dir("*", 32)' + - 'Dir("*", 63)' + - Dir("nosub\*") + - Dir(files_NoDrive & ":\*") + - Dir("a