AMRenameFile Method

Action2 Example

 

Encapsulates the AutoMate™ action in the “File I/O” group, “Rename a file.” The method attempts to rename the specified file from one filename to another.

 

Declaration

function AMRenameFile (varOldName As Variant,

varNewName As Variant) As Integer

 

Parameters

varOldName

 The full path to the file to be renamed.

 

varNewName

 The full path and new name of the file.

 

Description

The AMRenameFile method attempts to rename the source file varOldName to varNewName.

 

If the file is successfully renamed, AMRenameFile returns “0.” If an error occurs, AMRenameFile returns “1.” In this case, use the GetLastError property to retrieve the error message AutoMate™ generated when trying to rename the file.

 

The AMRenameFile method supports wildcards.

 

The AMRenameFile method is identical to the AMMoveFile method.