Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
Name Statement
This standard VB statement renames a file or copies a file from one folder to another.
Syntax
Name [path1\]oldfilename As [path2\]newfilename
Returns
Not applicable
Usage
To be renamed, the file must be closed. If the file oldfilename is open or if the file newfilename already exists, Siebel VB generates an error message.
If this statement is used within the Siebel application, and no path2\ is specified, a copy of the original file goes in the
c:\siebel\bin
folder under the new name.Example
This example creates a temporary file,
c:\temp001
, renames the file toc:\temp002
, then deletes them both. It calls the subprogramCreateFile
to create thec:\temp001
file.(general) (declarations)
Option Explicit
Declare Sub CreateFileSub CreateFile
Rem Put the numbers 1-10 into a file
Dim x as Integer
Dim y()
Dim startletter
Open "C:\TEMP001" for Output as #1
For x = 1 to 10
Write #1, x
Next x
Close #1
End SubSub Button_Click
Call CreateFile
On Error Resume Next
Name "C:\TEMP001" As "C:\TEMP002"
Kill "TEMP001"
Kill "TEMP002"
End SubSee Also
FileAttr Function
FileCopy Statement
GetAttr Function
Kill Statement
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |