Invalid FSO process call or parameter issues

Source: Internet
Author: User

When calling the createtextfile method of the FSO object, the error "invalid process call or parameter" may be reported,
When using ASP to generate a static page, if the input string parameter is encoded as UTF-8, the default createtextfile method may report an error. The third parameter (encoding) of this method should be used) if this parameter is set to true, the created file is saved in Unicode encoding; otherwise, the file is saved in ASCII encoding.

For other methods, an error similar to the following is reported. This error is generally caused by the null input parameter. You can use isnull to make a judgment before calling.

Error Type:
Microsoft VBScript runtime error (0x800a0005)
Invalid process call or Parameter

For details about the createtextfile method, refer:

Description
Creates a specified file and returns a textstream object. This object can be used to read or write the created file.
Syntax
Object. createtextfile (filename [, overwrite [, Unicode])
The syntax of the createtextfile method is as follows:

Partial description
Object is required. The name of the FileSystemObject or folder object.
Filename is required. String expression, indicating the file to be created.
Overwrite is optional. Boolean indicates whether existing files can be overwritten. If the file can be overwritten, the value is true. If the file cannot be overwritten, the value is false. If this value is omitted, the existing file cannot be overwritten.
Unicode is optional. Boolean indicates whether to create a file in Unicode or ASCII format. If a file is created in unicode format, the value is true. If a file is created in ASCII format, the value is false. If this part is omitted, an ASCII file is created.

Description
The following code illustrates how to use the createtextfile method to create and open a text file:
Sub createafile
Set FS = Createobject ("scripting. FileSystemObject ")
Set a = FS. createtextfile ("C:/testfile.txt", true)
A. writeline ("this is a test. ")
A. Close
End sub

If the overwrite parameter of a file already exists in filename is false or this parameter is not provided, an error occurs.

Appendix:

FSO opentextfile method description
Open the specified file and return a textstream object. You can use this object to read, write, or append the file.

Object. opentextfile (filename [, iomode [, create [, format])
Parameters
Object is required. The object should be the name of FileSystemObject.
Filename is required. Specifies the string expression of the file to be opened.
Iomode is optional. It can be one of the three constants: forreading, forwriting, or forappending.
Create option. Boolean value, indicating whether to create a new file when the specified filename does not exist. If a new file is created, the value is true. If the file is not created, the value is false. If not, no new file is created.
Format is optional. Use one of the three-state values to specify the file opening format. If ignored, the file is opened in ASCII format.
Set
The iomode parameter can be any of the following settings:

Constant Value description
Forreading 1 open the file in read-only mode. This file cannot be written.
Forwriting 2 open the file in write mode
Forappending 8 open the file and write it from the end of the file.

The format parameter can be any of the following settings:

Value description
Tristatetrue open a file in unicode format.
Tristatefalse open an object in ASCII format.
Tristateusedefault: open a file by default.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.