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

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

原文地址:https://www.cnblogs.com/joeblackzqq/p/1965201.html