Siebel VB Language Reference > VB Language Reference >

ChDir Statement


This standard VB statement changes the default folder for the specified drive.

Syntax

ChDir [drive][[\]folder\]folder

Argument
Description

drive

The name of the drive containing the desired default folder as a letter, or a string expression representing the drive name; a colon is not required

[\]folder\

If the folder is not within the current folder of the specified drive (or the default drive if none is specified), the path to the folder to become the default, or a string expression representing the path

folder

The name of the folder to become the default, or a string expression representing the folder name

Returns

Not applicable

Usage

If the drive argument is omitted, ChDir changes the default folder on the current drive. If the initial backslash in [\]folder\ is omitted, ChDir changes to a folder within the current folder. If it is included, the path is followed from the root folder.

The ChDir statement does not change the default drive. To change the default drive, use ChDrive.

Example

This example changes the current folder to C:\Windows, if it is not already the default.

Sub Button_Click
   Dim newdir as String
   newdir = "c:\Windows"
   If CurDir  <>  newdir then
      ChDir newdir
   End If
End Sub

Related Topics

ChDrive Statement
CurDir Function
Dir Function
MkDir Statement
RmDir Statement

Siebel VB Language Reference Copyright © 2006, Oracle. All rights reserved.