检测文件夹是否存在,不存在则创建

On error resume Next

Dim mu_sFilePath, mu_sFileName
mu_sFilePath = "textFolder/"
mu_sFileName = mu_sFilePath & "ResultVoice.txt"

Dim fs
set fs = CreateObject("Scripting.FileSystemObject")
if(fs.FolderExists(mu_sFilePath)) Then                     '检测文件夹是否存在
    MsgBox "文件夹已存在"
else
    MsgBox "文件夹不存在"
    fs.CreateFolder(mu_sFilePath)                           '创建文件夹
end if
set fs = Nothing

posted on 2011-02-25 17:17  清清飞扬  阅读(1056)  评论(0编辑  收藏  举报