Previous Document Next Document

Object Model Reference : Classes : C : CorelScriptTools : Methods : CorelScriptTools.Rename


CorelScriptTools.Rename

Function Rename(Src As String, Dst As String, [Overwrite As Long = 1]) As Boolean

Description

Member of CorelScriptTools

The Rename statement changes the name of a file or folder, or can be used to move a file. You cannot move a folder using the Rename statement.

You can also use Rename as a function: it returns True (-1) if the Rename operation is successful or False (0) if is not.

Parameter
Description
Src
Specifies the name of the file or folder to move. file_folder1 can include drive and folder path specifics; if path specifics are not included, Rename assumes the current folder.
Dst
String expression specifying the name of the file where file_folder1 is to be moved. file_folder2 can include drive and folder path specifics; if path specifics are not included, Rename assumes the current folder.
Overwrite
If file_folder2 already exists, determines whether to overwrite the existing file (you cannot overwrite existing folders):
0 = rename and overwrite
1 = overwrite fails (default if omitted)

Example 1

The following VBA example moves the example1.vp file to the Work folder on the D drive.

' statement example
DIM x AS STRING
DIM y AS STRING
x = "C:\work\example1.vp"
y = "D:\work\example1.vp"
RENAME x, y, 0
Example 2

The following VBA example renames the example1.cdr file to example2.cdr and assigns -1 to success.

' statement example
DIM x AS STRING
DIM y AS STRING
x = "C:\work\example1.cdr"
y = "C:\work\example2.cdr"
success = RENAME (x, y, 0)

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.