ChDrive 语句

修改当前驱动器。

warning

Some DOS-specific file and directory functions are no longer provided in Collabora Office, or their function is only limited. For example, support for the ChDir, ChDrive and CurDir functions is not provided. Some DOS-specific properties are no longer used in functions that expect file properties as parameters (for example, to differentiate from concealed files and system files). This ensures the greatest possible level of platform independence for Collabora Office. Therefore this feature is subject to removal in a future release.


note

The ScriptForge library in Collabora Office 7.1 introduces the FileSystem service with methods to handle files and folders in user scripts.


语法:


  ChDrive Text As String

参数:

Text」: 含有新驱动器号的任意字符串表达式。如果需要,也可以使用 URL 表示法

驱动器号必须使用大写字母。在 Windows 环境下,为驱动器指定的字母受 LASTDRV 设置的限制。如果驱动器变量是一个多字符字符串,则只会采用第一个字母。如果您尝试访问一个不存在的驱动器,将发生错误,通过 OnError 语句可以对这个错误做出响应。

错误代码:

5 无效的过程调用

68 设备不可用

76 未找到路径

示例:


  Sub ExampleChDrive
      ChDrive "D" ' 必须存在驱动器 'D'。
  End Sub

请支持我们!